Michał Turczyn
Michał Turczyn

Reputation: 37367

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:

Upvotes: 3

Views: 1419

Answers (2)

sobelito
sobelito

Reputation: 1615

Had this issue w/ 16.9.x or 16.10.x (both vs2019) as noted here https://developercommunity.visualstudio.com/t/1691-and-1692-Edit-And-Continue-Brok/1374733. Upgraded to 16.11.12 and finally resolved.

Upvotes: 0

Dan Z
Dan Z

Reputation: 786

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.

Upvotes: 2

Related Questions