I have an Excel-DNA project in C# using .NET 4.0 using Visual Studio 2010/2015.
If I start Debug and use the "Start external program" feature to launch EXCEL.exe I am able to pause the debugger and Edit & Continue works perfectly fine.
However, if I try to attach to a running EXCEL.exe process I get an error message saying Edit & Continue is not supported for one of various reasons. When selecting to attach to a process I only have "Managed (v4.6, v4.5, v4.0)" selected.
The error message states:
Changes are not allowed in the following cases:
- Attached to a process that does not support Edit and Continue on attach.
- The code being debugged was optimized.
- The assembly being debugged is loaded as domain-neutral.
- The assembly being debugged was loaded through reflection.
- Intellitrace events and call information is enabled.
- The .NET Runtime this program is running does not support edit and continue.
What is the difference between these two scenarios? What does "Start external program" do differently than manually attaching?
This is well documented:
Edit and Continue is not available in the following debugging scenarios:
- Debugging an application with Attach to rather than running the application with Start from the Debug menu.
The workaround you found by using the "Start external program" option is the correct approach.