-
Notifications
You must be signed in to change notification settings - Fork 228
Razor View NullReferenceException Stacktraces are very unhelpful #1757
Comments
@strich what version of Razor/Mvc etc. are you using? I can't reproduce locally using 2.0. |
Does you add the DeveloperExceptionPage ( |
@NTaylorMullen I'm on the latest .NET Core 2.0 stuff. What exactly are you trying to repo? Just to be clear - This isn't an issue with the standard template code as I've modified it. This is a issue to raise the lack of helpful stacktracing on trivial nullref's in Razor views. @pranavkm Ah you might be confused - What I've pasted above is from a server log as I was trying to dig deeper. The very same stacktrace is pretty printed to the client browser. But no line numbers or code line previews. Just that very unhelpful trace. |
Error is in |
@benaadams I have confirmed that the pdbs are indeed copied as part of a normal debug publish and the files are sitting there next to the dlls on the server. |
including the |
@benaadams yep: |
Odd no line numbers then... Full framework or .NET Core (2.0 or 1.x)? Which version of ASP.NET Core (1.x, 2.0, etc) Think there was an issue with pdbs on Full framework that should have been fixed with ASP.NET Core 2.0 aspnet/Mvc#6442 |
@pranavkm can you take a look and see if anything can be done? |
Looks like reading full pdbs, which is what we default to if on a Windows machine with VS \ pdb writer components installed, was broken in 2.0.0. Here's the tracking issue https://github.com/dotnet/corefx/issues/21079. For reasons I haven't dug in to, runtime compiled views have the right line mappings, but precompiled views do not, even though they're producing the same kind of pdb. I'll see if they have any interest in porting the fix from 2.1.0 (which works fine) back to 2.0.0. Unfortunately, in the absence of a fix from CoreCLR and the missing feature in , there isn't much that can be done to fix this. The only workaround I could suggest is to run the application ( |
Looks like there's already an issue tracking porting the fix for 2.0.x - https://github.com/dotnet/coreclr/issues/15254. |
For myself, I'm happy to upgrade to v2.1 so I would consider this problem resolved pending confirmation. |
@strich if you're feeling rather adventurous, nightly builds of the 2.2 SDK \ 2.1 runtime are available here - https://github.com/dotnet/cli#installers-and-binaries. 2.2.0-preview1-007796 is the sdk version our builds are currently using. |
So it sounds to me like this is a known issue dotnet/coreclr#15254 - and this will start working better in 2.1 - any reason to keep this bug around? |
Nope. I added a work item to get some tests around this covered in MusicStore so we can catch these regressions early. In addition, I'm going to work on getting aspnet/Mvc#7006 in for 2.1.0 so the pdbs we produce are in line with what the app produces. |
This is based upon an issue I originally raised over on the EFCore repo: dotnet/efcore#10221 (comment)
The following line of code had a nullref exception in it that caused the view to fail to present me with a stacktrace view:
The
Logins
object is null.Stacktrace:
This is a debug enabled build with developer exceptions turned on. This stacktrace was incredibly unhelpful in directing me to the root cause. In my original issue someone noted that there is an open issue to improve the readability of stacktraces (dotnet/extensions#274), but AFAIK it doesn't help actually point to that line of code in question.
The text was updated successfully, but these errors were encountered: