'VS 2022 errors ENC0020, ENC0021 even though code changes were made prior to starting debug session
Does anyone know how to solve this problem?
I have a solution with multiple projects, including: 2 Class Libraries, 1 REST API server, 1 Web server, 2 REST API clients. I made a change in the code underneath REST API server - I changed a function to async, and added await to the calls to it.
I made the code changes while NOT debugging - it was not in run mode. I then cleaned the entire solution and did a rebuild all. However, when I press Run to debug, I get the following errors.
HOWEVER - the code runs. I can set breakpoints and step through the new code I added, it executes. No idea why it is showing the errors.
Severity Code Description Project File Line Suppression State
Error ENC0020 Renaming method requires restarting the application. RESTServer E:\Data\dotNetDev\ea\RESTServer\RESTServer\Models\AccountModel.cs 231 Active
Error ENC0021 Adding parameter requires restarting the application. .Core E:\Data\dotNetDev\ea\RESTServer\.Core\System-email.cs 45 Active
Error ENC0021 Adding await expression requires restarting the application. RESTServer E:\Data\dotNetDev\ea\RESTServer\RESTServer\Controllers\AccountController.cs 161 Active
Error ENC0021 Adding await expression requires restarting the application. RESTServer E:\Data\dotNetDev\ea\RESTServer\RESTServer\Controllers\AccountController.cs 212 Active
Error ENC0021 Adding await expression requires restarting the application. RESTServer E:\Data\dotNetDev\ea\RESTServer\RESTServer\Controllers\AccountController.cs 260 Active
Solution 1:[1]
Apparently closing and relaunching Visual Studio 2022 solved the problem.
Solution 2:[2]
A Rebuild of the Solution worked for me and removed the error.
I suspect something was stuck in debug mode.
Solution 3:[3]
It's look like a bug introduced in VS 2022 17.1.3 and 17.1.4, nothing to do except restart VS.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jay Imerman |
| Solution 2 | notidaho |
| Solution 3 | anisite |
