Developer forum

Forum » Development » Debugging: No Symbols loaded for Compiled Razor Files

Debugging: No Symbols loaded for Compiled Razor Files

Justin Sjouw Dynamicweb Employee
Justin Sjouw
Reply

Hi,

I'm trying to debug a local solution, but breakpoints in the cshtml files are not hit with the message that symbols are not loaded.

I have taken the following steps:

  • Create a new dw10 project with "dotnet new dw10-suite"
  • Add Files from a built Swift folder including GlobalSettings and db connection
  • Made sure the build settings are all set to debug, "ASPNETCORE_ENVIRONMENT": "Development", in launchSettings.json

At this point I thought I should be able to do a "dotnet run" and then attach to the donet process from VS 2022.

The solution runs ok (expect for an error I want to debug :-)) but I cannot debug, in "Debug>Windows>Modules" is see:

I have tried:

  • Also adding appsettings.json with "ASPNETCORE_ENVIRONMENT": "Development", in the environment settings
  • I added "ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": " Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" per some googled tips & tricks
  • Unchecked the "Just My Code" setting in "Debug>Options"
  • Unchecked "Suppress JIT optimizations ......" (Also per some googled troubleshooting)
  • Running both CMD and VS as Administrator
  • Checked .NET versions installed

Not sure what more to check :-)

Justin


Replies

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

Hi Justin,

We've communicated offline, but I'll just leave a comment here for anyone who comes across this post.

Debugging Razor templates on DW10 is not currently supported due to the compilation engine not creating valid debugging symbols. We're investigating possible solutions to this but I don't have a timeline for it at the moment.

- Jeppe

 
Justin Sjouw Dynamicweb Employee
Justin Sjouw
Reply

Hey Jeppe,

Thanks, any progress on this one? Would be very nice to cut down on some hours looking blindly for those pesky: System.NullReferenceException: Object reference not set to an instance of an object. issues I still see in some Swift razor templates more than I would like :-)

Justin

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

Short answer: no.

The issue is that the version of RazorEngine that we use have no active development, and the alternatives are not easily compatible. We have some options that we're discussing internally, as this also affects the ability to use custom assemblies in Razor templates, but nothing to report yet.

- Jeppe

 

You must be logged in to post in the forum