Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wrongly getting message "Edits were made to the code which cannot be applied while debugging"

I have searched a lot about the issue and found nothing, i.e. I tried every suggestion that I found to solve it, but none worked.

So as a last resort, I try here..

I am getting

Edits were made to the code which cannot be applied while debugging.

message, event if I just only add a comment.

I know you cannot modify generic method or add/remove await operators, which would disable debugging session from continuing. But that's not the case.

When I check error list, it is empty.

From what I searched this is known VS bug known for years now, but from what I have read it should be fixed by now (I just updated VS).

The weird thing is that behaviour occurs only in one solution.

Has anyone idea on how to tackle this problem, where to look, what to check.

I already tried:

  • updating VS
  • deleting .vs directory in solution directory
  • deleting bin and obj output directory in every project
  • cleaning and rebuilding solution
  • setting "Enable Edit and Continue" option on and off under Options/Debugging/General tab.
  • deleting *.user files, I do not have any *.suo files
like image 585
Michał Turczyn Avatar asked Mar 20 '26 11:03

Michał Turczyn


1 Answers

Is your project an asp.net core web app?

There is an ongoing bug in VS 2019 where:

If there are two are more .cshtml files with the same name anywhere in your solution then Edit-and-Continue stops working even for simple changes.

Note that having 2 .cshtml files with the same name breaks Edit and Continue throghout the entire project, .cs files included.
See the issue reported here (and if possible upvote the issue so that it gets more attention from MS).

I had 2 files named "_ViewImports.cshtml" in different folders. Removing one of them restored my ability to edit-and-continue in that project.

like image 165
Dan Z Avatar answered Mar 22 '26 03:03

Dan Z



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!