4

I'm building a quite simple c# windows Forms Application in Visual Studio 2017, Framework version 4.7

I cannot use the Edit and Continue functionality even if my project is compiled in Debug mode, code optimization is disabled, TRACE and DEBUG flags are ON and all the settings used in many other projects are set.

The problem is I cannot use the "Edit and Continue" functionality. Investigating i found that during the debug, the modules window is reporting that my startup project is loaded with optimized code, while all my other referenced projects are not optimized as it should be. Infact I can debug and edit without problem the referenced libraries, but I cannot edit the main windows form application

enter image description here

This problem is driving me crazy from days now. Please help! How can i disable code optimization?

Niddu
  • 119
  • 8
  • Which Version of Visual Studio 2017 do you use? You can see that under "Help" > "About Microsoft Visual Studio" (or something like that, I have set another language). For me it is MS VS Enterprise 2017. I know back from VS 2015 that Edit and Continue is not supported on the Professional Version. – Filnor Jan 23 '18 at 08:44
  • I'm using Visual Studio 2017 Enterprise; but I can debug all the other projects i make without problem, even with Visual Studio Community. "VS 2015 that Edit and Continue is not supported on the Professional Version" that's not true – Niddu Jan 23 '18 at 08:55
  • Maybe you should try to migrate the source code to a new project, see if thath helps. If not, you may also repair and/or reinstall VS. In the Professional Version of VS 2015 I had no option to enable/disable E&C, so I guess you can call it "not supported". – Filnor Jan 23 '18 at 09:00
  • I already reinstalled Visual Studio 2015 first, and then 2017. Also my workmate computer has the same problem with this project, so it is something related to the project itself. I cannot recreate the project since it is a ClickOnce application already distrubuted on many workstations – Niddu Jan 23 '18 at 09:49

1 Answers1

3

Removing from AssemblyInfo.cs file the line

[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]

solved my problem

I don't know who added this parameter, but removing it the "Edit and Continue" started working

I also had another unwanted parameter:

[assembly: CompilationRelaxations(8)]

but this seems to do not affect the debugger. I removed it anyway

Niddu
  • 119
  • 8
  • You ought to take this more seriously. This code was not written by a programmer. Could be because somebody lost that code and the only way to get it back was to decompile the exe. Or you could be participating in a crime. Talk to your supervisor about it. – Hans Passant Jan 24 '18 at 09:27