0

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?

robodude666
  • 178
  • 1
  • 13

1 Answers1

1

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.

Community
  • 1
  • 1
Jack Zhai
  • 6,230
  • 1
  • 12
  • 20
  • How is attaching to a running process vs a "start" process any different? The error message makes it sound like it's possible if the application supports Edit and Continue on attach. How does one make an application support it? – robodude666 Aug 19 '16 at 15:54
  • @robodude666, "attach to process" is used to for process that's already running, for example, debug ASP.NET apps which deploy to the IIS, we need to use this feature. But Start external program was used to give you the external program which helps you debug your code, for example, to debug class library project(we couldn't debug it directly), you could choose Start external program and give a path of one external program that will call your DLL. – Jack Zhai Aug 22 '16 at 02:53
  • Right, but doesn't VS still need to attach to the process after starting the external program? – robodude666 Aug 22 '16 at 15:21
  • It is related to your real app type and how you really debug your app, for example, I need to start one process, and then run the coded UI test in the UI process, during I debug my test project, I don't need to use the attach to process. – Jack Zhai Aug 23 '16 at 08:54