Skip to content

[Blazor] NullReferenceException in RenderTree and massive memory usage #10143

@helloserve

Description

@helloserve

When I attempt to test my project end-to-end from the UI down to the SQL database and back out, I see two NullReferenceException entries in the Output window, and the Visual Studio Debug Console, and RAM usage shoots up to 25GB.

To Reproduce

Steps to reproduce the behavior:

  1. Running 3.0.0-preview5.19227.x on all components and packages
  2. Pull the code in this branch
  3. Setup a database and apply the Vxxx__Blogs.sql script. Insert a blog entry with key title-1.
  4. Fulfill appsettings.json config for connection string.
  5. Run app, click on "Blogs" nav button and then on "Title 1" entry.
  6. Check Output window and diagnostics pane.

The output I see is

System.NullReferenceException: Object reference not set to an instance of an object.
   at helloserve.com.Pages.Blog.BuildRenderTree(RenderTreeBuilder builder)
   at Microsoft.AspNetCore.Components.ComponentBase.<.ctor>b__5_0(RenderTreeBuilder builder)
   at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment)
   at Microsoft.AspNetCore.Components.Rendering.Renderer.RenderInExistingBatch(RenderQueueEntry renderQueueEntry)
   at Microsoft.AspNetCore.Components.Rendering.Renderer.ProcessRenderQueue()
Microsoft.AspNetCore.Components.Server.ComponentHub: Warning: Unhandled Server-Side exception

System.NullReferenceException: Object reference not set to an instance of an object.
   at helloserve.com.Pages.Blog.BuildRenderTree(RenderTreeBuilder builder)
   at Microsoft.AspNetCore.Components.ComponentBase.<.ctor>b__5_0(RenderTreeBuilder builder)
   at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment)
   at Microsoft.AspNetCore.Components.Rendering.Renderer.RenderInExistingBatch(RenderQueueEntry renderQueueEntry)
   at Microsoft.AspNetCore.Components.Rendering.Renderer.ProcessRenderQueue()
Microsoft.AspNetCore.Routing.EndpointMiddleware: Information: Executed endpoint '/_blazor'
Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request finished in 4799.7255000000005ms 101 
'helloserve.com.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.0.0-preview5-27626-15\System.Diagnostics.Process.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The thread 0x33a4 has exited with code 0 (0x0).
The thread 0x22c4 has exited with code 0 (0x0).
The program '[20408] helloserve.com.exe' has exited with code -1 (0xffffffff).

Expected behavior

When you switch the solution configuration to UITest, a compiler directive in Startup.cs swaps out a mock service for the page. This hard coded blog post entry is loaded and rendered correctly by the Blazor component.

I might be doing something wrong elsewhere in my stack, but I find it strange that I would see it manifest in the page and not earlier. The memory usage is a big concern though...

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions