I am debugging a .NET 4.0 application in Visual Studio 2015. My application builds and works fine, but when I try to edit and continue working under the debugger, no matter what changes I make or where I create them my main project, I get a dialog, which says:
Changes have been made that cannot be compiled. Execution cannot continue until compiler errors are fixed.
As an example of the change I'm talking about, I tried to add this line to various methods:
Console.WriteLine("foo");
When I look in the Visual Studio error list area, I see only one error CS7038 with the description "Failed to fix the module" <my app name> ". There is no file name, line number or symbol. My code does not have clear red underscores. If I I’ll stop the running application, build it with the changes and run it again, everything will build and work fine, so there is some discrepancy between what the build-time compiler and the edit-and-continue compiler consider acceptable.
Does anyone know how to get more information about why compilation doesn't work in edit and continue mode? I read something about connecting and debugging the VBCSCompiler process, so I tried it, but even if all types of exceptions are set to break on throw, the connected VS never broke.
I do not use code because it is not a question of my code, but rather of strategies for figuring out what the Edit and Continue compiler thinks are wrong, and for everyone I know, the source of the compiler error can be anywhere in my entire project.
Edit:
As mentioned in the comments, I was able to connect the debugger to Visual Studio and crash when an exception was thrown after clicking Continue after editing the code. An exception was a System.NotSupportedException with the following message: "Changing the assembly reference version during debugging is not allowed." He listed the name of the assembly in question, which was a small VB.Net project used by my application, which mainly relates to C #. I am trying to create an MCVE to be sent to Microsoft, but currently I cannot reproduce the problem in a smaller solution with only one VB and one C # project.
Edit 2:
I found a workaround and answered this question myself if someone else is faced with this strange problem, but I leave the "Answer" checkbox for anyone who can explain what is happening (why the compiler believes that the version number of the mentioned project has changed to editing time).
c # visual-studio visual-studio-2015 roslyn edit-and-continue
adv12
source share