4

Visual Studio 2019 lets me edit C# source code files whilst the application is running/being debugged and not paused. This leads to errors when the application is paused and I attempt to start it again.

How can I stop visual studio from letting me edit files whilst the application is in debug mode and not paused?

I did not know it was even possible to enable such a thing.

Update: VS2019 is now crashing to desktop when I debug. I see the following error in windows event logs which references edit & continue. How do I resolve this?

> "Application: devenv.exe Framework Version: v4.0.30319 Description:
> The process was terminated due to an unhandled exception. Exception
> Info: System.NullReferenceException    at
> Microsoft.VisualStudio.LanguageServices.EditAndContinue.VisualStudioDebugStateChangeListener+DebuggerService.Microsoft.VisualStudio.Debugger.ComponentInterfaces.IDkmModuleInstanceLoadNotification.OnModuleInstanceLoad(Microsoft.VisualStudio.Debugger.DkmModuleInstance,
> Microsoft.VisualStudio.Debugger.DkmWorkList,
> Microsoft.VisualStudio.Debugger.DkmEventDescriptorS)    at
> Microsoft.VisualStudio.Debugger.EntryPoint.IDkmModuleInstanceLoadNotification_OnModuleInstanceLoad(IntPtr,
> IntPtr, IntPtr, IntPtr)
rollsch
  • 2,518
  • 4
  • 39
  • 65
  • 1
    yes and I found no answers as this is not a common problem. I also checked the microsoft forums and support tickets. – rollsch Aug 07 '19 at 05:40
  • 1
    I am not trying to disable "edit and continue" I want that feature. It appears edit and continue is broken, edit and continue should only work then the application is PAUSED. In my case I can edit and (not continue as it crashes) whenever the application is running. – rollsch Aug 07 '19 at 05:41
  • maybe [this](https://stackoverflow.com/a/54158983/7901692) help – Ramin Rahimzada Aug 07 '19 at 05:43
  • Updated with a new crash. VS2019 is now bricked. – rollsch Aug 07 '19 at 05:56
  • One thing i hate about this is that if i edit the file while running i cannot stop it anymore and edit because source and running code no longer match. This is a serious problem, could you please add links to the other threads you started so we can try to keep up if this question doesn't get answers? – Matteo Jan 13 '20 at 09:18
  • It seems to be in all versions of VS2019 now. Ive gotten a few issues similar to this fixed recently. The best method is to post an issue on the Roslyn github page with a very detailed reproduction, videos definitely help. Sam Harwell and Cyrus Najmabadi were both very helpful. Cyrus doesn't even work for MS but he seems to have some sway over what gets fixed and what doesn't. – rollsch Jan 14 '20 at 23:28

1 Answers1

-1

I found this "utility" very frustrating too, but I found an explanation (and solution) to this:

  • Edit your coude while application is running.
  • The changes are underlined in green and if you put the pointer over, will see the message you describe.
  • Pause the application
  • ReRun application
  • the code should be update WITHOUT restart the application

You can found the MS explanation and more info at: Disable being able to edit code while debugging

Pila 77
  • 395
  • 4
  • 12
  • My problem is the program is running and NOT PAUSED. Eg its a bug in VS – rollsch Jun 11 '20 at 11:16
  • Yes, its running and yoy modify something. After that you must pause and the continue and the changes will apply without restart the entire project. – Pila 77 Jun 12 '20 at 12:03
  • The problem is "edit and continue" is bugged in that it lets you edit the source code whilst the program is NOT PAUSED. Then if you pause the program and press continue it says the source code does not match and breaks the debugging session. – rollsch Jun 17 '20 at 04:15