Closed ajaybhargavb closed 3 years ago
Is this with Pages? or regular Razor files?
Regular razor files. I didn't test with pages.
I get this message in the error list.
My guess is that something is rev-ing the generated code, which is causing the ENC error.
We should figure out if this is related to how we do checksums. Is this an artifact of having checksums in the design time code?
Is this an artifact of having checksums in the design time code?
No. We do not generate checksums in design time.
@alexgav is taking a look.
This is being tracked here
This still lives huh? Been a couple years I think. Well if it helps, I have this issue whenever I include namespaces and/or add a "addTagHelper" to the _ViewImports.cshtml file in a project.
When I leave only the "@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers" line in there, I have no issues when I place a breakpoint in a razor file or if I have Exception settings set to "Break When Thrown" and an exception occurs in a razor file.
But the moment I add a namespace or other tag helper to _ViewImports.cshtml I'm not able to continue debugging, (this may be dependent on the scope of the taghelper or the need of the namespace for that razor file/view).
@sotoabraham thanks for this - it's a bit strange that this is still an issue but indeed on netcore2.2 my project uses SpaServices tag helper and if I remove it, I have no issues debugging / even having cshtml files open.
It's a weird one that's plagued my new clients project for years but nobody has ever bothered looking into it, their workflow has literally been "place your breakpoint, close the file, and re-start the project" which is a horrible workflow lol.
I had a _ViewImports.cshtml
within one View's folder (Views/Foo
), and in it had a single namespace that had been commented out, making the import not needed. Removing this file fixed the problem. Then re-adding the _ViewImports.cshtml
, even testing with the same commented out namespace, suddenly couldn't reduplicate the problem. Keep in mind I cleaned the solution, deleted obj / bin, etc, many times over before finding this solution, none of which helped. So ... there is indeed something messed up here, I just wanted to add this little extra bit if it helps to solve the problem.
I am having this issue as well. It started when I started working on asp.net core 3.0 applications and VS 2019. My solutions are extended from the standard web application project templates. I can just open a fresh IDE, go straight to a debug execution, and if I hit a breakpoint I often can't resume. Same warning ENC0021 as others have reported in my Error List panel and same dialog box telling to me Edit or Stop.
Funny thing today, I was staring at the warning in anger and it disappeared before my eyes, no interaction by me at all. I hit F5 and could continue. That has happened exactly once...
I don't believe this is a design time issue. To me it behaves as if the debugger thinks code files are being written to at the time a breakpoint is hit.
Any updates regarding this...?
@ajaybhargavb the referenced issue has been resolved. Should this be closed already?
This has been fixed.
Steps to reproduce:
Index.cshtml
I think this is probably a tooling issue but I am not sure.
VS version: 26621.2.d15rel