Skip to content

Blazor client debugger incorrectly reading object values as null #77031

@bensmith009988

Description

@bensmith009988

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

While running a Blazor Web Assembly (Hosted) project, I am running into a problem while debugging (on visual studio enterprise 2022) in the client project. Newly instantiated objects with duplicate names as other objects, in the method, appear null while debugging. If they were truly null, then null reference exceptions would be thrown when calling methods on the object. They return the correct data to the UI, so there is no way for the objects to actually be null.

Expected Behavior

When stepping through a project, I would expect to see the debugger highlight and display values as it should. Instead, I am seeing the object value as null, even after value assignment. Setting a default constructor with a breakpoint and debugging shows the constructor being hit, but the object value still shows null.

Steps To Reproduce

The README file in the repository here includes startup instructions to launch and run the sample project. Additionally, it includes instructions to find specific debugging steps that give line-by-line instructions for breakpoints while debugging to replicate the bug.

Exceptions (if any)

Changing the names of objects in a method to be unique, (meaning no other objects in that method or class file have the same name) makes the bug disappear.

.NET Version

6.0.402

Anything else?

Here is a screenshot, while mid-debugging, in a code-block that should have thrown an exception but didn't because the value is not actually null. It only appears as such.

image

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions