问题
Recently when I've been debugging my application, I've been able to write code into C# files when the application isn't in the broken state. I've tried totally disabling the "Edit and Continue" setting in the visual studio options but that doesn't seem to be working.
What I'm expecting to happen is when I'm debugging and I type into a C# file, I want that popup that says "Changes are not allowed while the application is running" prompting me to put a breakpoint in my code to apply changes during runtime while the application is in the paused state. I'm not sure if this was a change that was introduced into the latest 2019 build or if there's something wrong with my options. Any ideas on this one would be great.
For reference, this is the popup that I want:
and these are my settings:
and proof of the functionality that I don't want
回答1:
According to the VS Team this works as designed:
This behavior you described is expected for Visual Studio 16.3. We went through several changes on Edit and Continue and now allow editing the code while the application is running. Any errors or warnings regarding your changes will show up at the Error List Window. In order to apply these changes, you simply have to be on a break state (e.g. break all or stop on a breakpoint) and continue from there.
Source: https://developercommunity.visualstudio.com/content/problem/768979/able-to-type-while-debugging.html
回答2:
Tools > Options > Debugging > General, select Edit and Continue in the right pane.
来源:https://stackoverflow.com/questions/58299640/disable-being-able-to-edit-code-while-debugging