-
Notifications
You must be signed in to change notification settings - Fork 5k
Debugger report null
for uninited static struct field in classes without an .cctor
#39993
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Tagging subscribers to this area: @tommcdon |
Due to lack of recent activity, this issue has been marked as a candidate for backlog cleanup. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process. This process is part of our issue cleanup automation. |
This issue will now be closed since it had been marked |
Uh oh!
There was an error while loading. Please reload this page.
Description
Debugger will report
null
instead ofdefault(...)
for uninited static field(struct) in classes without an static ctor. It's an value type and should never be null.Get
null
when watch the field in debugger, andArgumentNullException
when try to access any member of the field in debugger.It only affect the debugger, running the program can get the right result. And after access the field in program or add an static ctor, the debugger can also get the right value.
Configuration
Which version of .NET is the code running on: netcoreapp2.1/3.1/net5.0(x64)
What OS and version, and what distro if applicable: win10 x64(2004)
What is the architecture (x64, x86, ARM, ARM64): x64
Debugger: VS/VSCode
Regression?
This seems happen on all version of netcore(not tested with 1.x), but not happen on any version of netframework(tested with net48), not sure if it's an issue of runtime or debugger of VS.
Other information
See
null
forProgram.dateTime
in debugger before Console.WriteLine and0001-01-01
after Console.WriteLineThe text was updated successfully, but these errors were encountered: