Home > Software design >  Visual Studio error ENC0039: What's the rationale behind it?
Visual Studio error ENC0039: What's the rationale behind it?

Time:09-17

I'm debugging an application in VS 2022. I noticed that one of my ||'s wasn't properly formatted, so I fixed it.

// Before
while ((deq = ItemsToAppend.TryDequeue(out T? item))|| CanAppend)
// After
while ((deq = ItemsToAppend.TryDequeue(out T? item)) || CanAppend)

As soon as I fixed it, I got the following error

ENC0039: Modifying whitespace or comments in method inside the context of a generic type requires restarting the application. image

Obviously this is coming from somewhere within the IDE, and I can fix it by simply restarting the application under debug, but why would this be a problem? Aren't whitespace and comments something that doesn't matter to the compiled output? Or does Roslyn need such a level of introspection that even changing whitespace messes it up?

CodePudding user response:

Whitespace affects position of sequence points which influence breakpoint placement and stepping through statements of the method. The debugger currently does not support changing this debugging information in generic types and methods while debugging.

  • Related