We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Runtime error when deployed to production

Hi,
I deployed Blazor server app to production server.
i have enbled error reporting with;
services.AddServerSideBlazor().AddCircuitOptions(options => { options.DetailedErrors = true; });
This is what i am getting in the web console:
[2020-01-06T15:05:15.109Z] Error: System.NullReferenceException: Object reference not set to an instance of an object.
at Syncfusion.EJ2.Blazor.SyncfusionBlazorService.GetContext()
at Syncfusion.EJ2.Blazor.BaseComponent.OnInitializedAsync()
at Syncfusion.EJ2.Blazor.Calendars.EjsDatePicker`1.OnHybridInitialized()
at Syncfusion.EJ2.Blazor.Calendars.EjsDatePicker`1.OnInitializedAsync()
at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
Below app works ok on the development server

23 Replies

DN Dino Novak January 6, 2020 09:05 PM UTC

This is page on which error occures.
So the page is showing loading icon untill data is loaded in OnInitializedAsync() - I am doing multiple fetched to DB here so this takes a few seconds,
after that page should be refreshed and form with loaded data should be shown.

I suspect that due to page refresh (after all data is loaded) syncfusion service context is lost

Code for page:

@page "/seamanapplication2"

@using ApplicationShared.Models
@using ApplicationShared

@inject AppState _appState
@inject NavigationManager _uriHelper
@inject SeamanService _seamSvc

@if (seaman == null)
{
    <div class="sk-circle">
        <div class="sk-circle1 sk-child"></div>
        <div class="sk-circle2 sk-child"></div>
        <div class="sk-circle3 sk-child"></div>
        <div class="sk-circle4 sk-child"></div>
        <div class="sk-circle5 sk-child"></div>
        <div class="sk-circle6 sk-child"></div>
        <div class="sk-circle7 sk-child"></div>
        <div class="sk-circle8 sk-child"></div>
        <div class="sk-circle9 sk-child"></div>
        <div class="sk-circle10 sk-child"></div>
        <div class="sk-circle11 sk-child"></div>
        <div class="sk-circle12 sk-child"></div>
    </div>
}
else
{

    <EjsDatePicker TValue="DateTime?"></EjsDatePicker>

}

    @code {

        Int32 SeamanId;
        Seaman seaman;
        protected IEnumerable<SeamanCertificateExtended> SeamanCertificates;

        protected override async Task OnInitializedAsync()
        {

            if (_appState.UserName != null)
            {
                SeamanId = _appState.UserID;
                seaman = await _seamSvc.GetSeaman(SeamanId);
                SeamanCertificates = await _seamSvc.GetSeamanCertificatesExtended(SeamanId);

            }

        }
    }


RC Roberto Conti January 7, 2020 11:32 AM UTC

Hi,
I'm in the same situation, the same error is raised from a page with an EjsGrid:

[2020-01-07T11:29:21.331Z] Error: System.NullReferenceException: Object reference not set to an instance of an object. at Syncfusion.EJ2.Blazor.SyncfusionBlazorService.GetContext() at Syncfusion.EJ2.Blazor.BaseComponent.OnInitializedAsync() at Syncfusion.EJ2.Blazor.Grids.EjsGrid`1.OnHybridInitialized() at Syncfusion.EJ2.Blazor.Grids.EjsGrid`1.OnInitializedAsync() at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()

As with Dino, the app works on development machine but does not work on production server.


BC Berly Christopher Syncfusion Team January 7, 2020 01:47 PM UTC

Hi Dino,

Greetings from Syncfusion Support.

We have validated your scenario. Unfortunately, we could not able to reproduce the reported issue at our end. We have made sample for your convenience, please check the attached sample. If you are still facing the issue or if we misunderstood your query, please share below details to proceed further. 

  1. Issue reproducing sample
  2. If possible, try to reproduce the issue in the attached sample.
 
Screenshots: 
 
 
 
 
Berly B.C 



DN Dino Novak January 7, 2020 08:26 PM UTC

Dear support Team,

please find attached sample that is reproducing error behavior.
I added appstate and it looks like this is the reason. Please note that this will run OK on Win10 development machine, you need to publish it to server (in my case Win2016 Server)




Attachment: Datepicker_e0982e4f.zip


BC Berly Christopher Syncfusion Team January 8, 2020 02:18 PM UTC

Hi Dino, 
  
Please make use of the suggested solution in the below stack overflow link that the “RenderMode“ as “Server” instead of “ServerPrerendered” to get rid of the reported issue.  
  
  
Still the issue persists, please revert us with issue details that will help us to check and proceed further.  
  
Regards, 
Berly B.C 



DN Dino Novak January 8, 2020 02:44 PM UTC

Dear Support Team,
please note that suggested change _Host.cshtml did not fix the error, error is appearing again

this is change in _Hosts.cshtml

    <app>
        <component type="typeof(App)" render-mode="Server" />
    </app>

Regards,
D


TO Tony January 9, 2020 03:57 AM UTC

Hi,

I am also having similar problem.
Everything works fine when running on my local machine, but will get the NullReferenceException when I navigate to any page using SyncFusion control after deployed on server.
In my case, I am deploying it on Azure.
I have tried switching between Release mode and Debug mode on both environments, but the app deployed on Azure will crash regardless while working fine on local machine.


RC Roberto Conti January 9, 2020 08:50 AM UTC

Hi,
still getting the same error here too.
This is the logged error (in addition to what previously reported from the browser console):

Unhandled exception in circuit 'IszWMcxJiZ3-QnYMWHpgf7Yi2ujvSX3OUjZ_tBeOjs0'.

Exception: 
System.ObjectDisposedException: Cannot access a disposed object.
   at Microsoft.AspNetCore.Components.RenderTree.ArrayBuilder`1.ThrowObjectDisposedException()
   at Microsoft.AspNetCore.Components.RenderTree.ArrayBuilder`1.GrowBuffer(Int32 desiredCapacity)
   at Microsoft.AspNetCore.Components.RenderTree.ArrayBuilder`1.Append(T[] source, Int32 startIndex, Int32 length)
   at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InsertNewFrame(DiffContext& diffContext, Int32 newFrameIndex)
   at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InsertNewFrame(DiffContext& diffContext, Int32 newFrameIndex)
   at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForRange(DiffContext& diffContext, Int32 oldStartIndex, Int32 oldEndIndexExcl, Int32 newStartIndex, Int32 newEndIndexExcl)
   at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.ComputeDiff(Renderer renderer, RenderBatchBuilder batchBuilder, Int32 componentId, ArrayRange`1 oldTree, ArrayRange`1 newTree)
   at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.RenderInExistingBatch(RenderQueueEntry renderQueueEntry)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()


SN Sevvandhi Nagulan Syncfusion Team January 9, 2020 02:19 PM UTC

Hi Tony,   

We have checked hosting the sample in Azure and we are unable to reproduce the reported issue at our end. On the first page if you click on Login button, DatePicker will be rendered. On FetchData page, you can find the Grid. Kindly refer the below hosted link. 


If still issue persists, kindly revert us with below details that help us to proceed further. 

  1. Issue reproducing sample
  2. Code snippet
  3. Hosted server link
  4. Share which are the features enabled in component

Regards,  
Sevvandhi N 



DN Dino Novak January 9, 2020 04:02 PM UTC

Dear Support Team,

are you able to reporoduce the issue based on DatePicker sample that was adjusted from my side?

Kind regards,
D.


TO Tony January 9, 2020 11:35 PM UTC

I think I have solved my problem.
I tried deploying to a different slot on Azure and it works fine.
So I compared the configuration of the two environments and found that the original slot that didn't work had the Stack set to .Net.
Setting it to .Net Core fixes all my problems.

Hope this help others who have similar problems.


KW Kevin Watson January 10, 2020 03:56 PM UTC

I am also having this issue. The problem appears to be tied to using "Azure SignalR Service" - still researching.

Test scenario:
  1. Created new App Service in Azure: Stack=.Net Core, Web Socket=True.
  2. Published to new App Service and ignored performance warnings about SignalR.
  3. Application works fine.
  4. On the publish screen added Azure SignalR Service.
  5. Published app.
  6. Application now broken with null reference in SyncfusionBlazorService.GetContext().
Note: Once broken, I have not been able to fix the app by removing Azure SignalR Service.

ymmv



DN Dino Novak January 13, 2020 02:35 PM UTC

Hello Support team,

I am still facing this issue and still no clue how to resolve it.
Can you please confirm that you have used my provided sample (attaching it again) and that you can reproduce the issue with it.
Also please advise what platform did you deploy to and what nuget version of Syncfusion was used.

Let me emphasise once again that error is not showing on development machine, only when it is published to separate server, in my case Windows 2016 Datacenter (latest updates appled).

I can suet up remote debugging session for you if required, but please email / PM me for this


Attachment: Datepicker_d6518a01.zip


PE Peter January 16, 2020 02:23 AM UTC

I faced the same issue. Reading the reply about identifying SignalR as a potential problem, I remembered that VisualStudio after publishing the solution is showing a dialog box that states that the SignalR service is not used with my Azure host and if WebSocket should be turned on. As I deployed another Blazor app using Syncfusion components successfully in the past, I was not paying attention and clicked 'No'. Motivated by the hint about SignalR, I was re-publishing and this time answering the dialog with 'Yes' to turn on WebSocket. Et voila, my app starts with no problem. I will research this in more detail to figure out if something with the default config of the App Service changed causing this problem. But I also remember that for some reason the original deployment was using .Net stack instead of .Net Core stack, not sure if I missed a setting as configuring the App Service or if this was an Azure glitch during deployment. I recognized the issue as I did review the config and manually corrected the stack. So there is another potential cause for the failing SignalR if it gets screwed up by manually switch the stack. I have no experience with server-side Blazor hosting yet and need to dive deeper into it. 


RC Roberto Conti January 17, 2020 08:14 PM UTC

More than 10 days after the issue has been reported and still no useful response from Support.
Everything tried has been unsuccessful and company decided Syncfusion components are not viable as they do not work at all.
That's a true pity.


DN Dino Novak January 17, 2020 08:29 PM UTC

Unfortunatelly,
We had a same case, now moved to Redzen Blazor componetns and have a working form.

Regards,
Dino


JA Jesus Arockia Sankaran S Syncfusion Team January 22, 2020 02:26 PM UTC

Hi Dino, 

Sorry for the long delay.  
  
We have checked your query with windows server and azure but it was not reproduced. Could you please refer the deployment steps in below link. 

Also ensure that the latest hosting bundle/sdks installed in your production machine. 

Meanwhile, we are checking in windows server with your queries. 

Regards, 
Jesus Arockia Sankaran S 



JA Jesus Arockia Sankaran S Syncfusion Team January 23, 2020 01:55 PM UTC

Hi Dino, 
 
We are deeply regret for the long delay in getting back to you.   
  
We have validated the reported runtime exception in various production server environment like Azure, Windows server 2016, etc.. And we  suspect that the issue occurred due to below cause when deployed in production server. 
  
1. The production server may have outdated configuration like .NET Core SDK and .NET Core runtime hosting bundle. 
             
Solution: Update your dotnet hosting bundle with latest version in your production machine. 
  
Please find the link below for latest hosting bundle and install it in your hosting machine to resolve this. 
  
  
  
 
  
  
2. Under the Application Development Roles in your production/deployment machine, ensure the following options are checked 
  
  • ASP
  • ASP.NET 4.6
  • WebSocket Protocol

 
  
Meanwhile we have handled the runtime null exception in our source and the fix is available in the below NuGet package. This will be included in our upcoming SP1 Release which is expected at the end of January 2020. 
  
  
Before installing the above nuget, please clear your local nuget cache by using below command. 
  
"dotnet nuget locals all --clear"  
  
or 
  
In Visual Studio, Click TOOLS -> Nuget Package Manager -> Package Manager Settings. Find the button "Clear All NuGet Cache(s)" 
  
If you are still facing the same issue, then please provide us the below details of your production machine/deployment server. 
  1. .Net Core SDK version
  2. .Net Core Runtime version
  3. Share the details by running 'dotnet --info
It will helpful to provide the better solution to resolve this as soon as possible. 
  
Please let us know if you need any further assistance on this. 
  
Regards, 
Jesus Arockia Sankaran S 



JA Jesus Arockia Sankaran S Syncfusion Team January 23, 2020 01:59 PM UTC

Hi Roberto, 
 
We deeply regret the long delay in returning to you. 
 
Please refer the above update regarding your issue and get back to us if you need any further assistance.  
 
Regards,  
Jesus Arockia Sankaran S 



JA Jesus Arockia Sankaran S Syncfusion Team January 23, 2020 02:01 PM UTC

Hi Jalil, 
 
Thanks for your patience.  
 
We request you to  refer the above update regarding your issue and get back to us if you need any further assistance.  
 
Regards,  
Jesus Arockia Sankaran S 



JA Jesus Arockia Sankaran S Syncfusion Team February 3, 2020 11:17 AM UTC

Hi All, 
  
Thanks for your patience. 
 
We have included the fix for the run time null reference exception in the latest release (Volume 4, 2019 SP) and it is available now in 17.4.0.46 version.  
 
Please let us know if you need any further assistance on this. 
Regards, 
Jesus Arockia Sankaran S 
 



PA Patrick November 5, 2020 02:25 PM UTC

Hello

Got the same error , but fixed by updating server role in Windows Server 2012 R2 .. In fact Websocket was inactive
Thanks a lot 

Patrick



MK Muthukumar Kannan Syncfusion Team November 6, 2020 06:57 AM UTC

Hi Patrick, 

Thanks for your update.

Please get back to us if you need any assistance.

Regards,
Muthukumar K


Loader.
Live Chat Icon For mobile
Up arrow icon