Typically, the debugger displays incorrect line numbers and switches to the old code if it runs a different version of the dll (old version) than the version displayed by your code. It happens
- when there is some kind of caching
- when the previous working version was closed incorrectly or is still running in another process.
- when Visual Studio does not point to the correct code
Usually, to fix this, you should:
(Start by trying to "clean up" and "rebuild")
- Stop all running or debugged Visual Studio projects.
- Close all Visual Studio solutions and windows so that Visual Studio does not start.
- (If the next step does not do this trick, then next time restart the computer, and then proceed to the next step)
- We open only the solution that needs to be launched. Click Clean Solution. Then "Restore the solution."
Check if this problem has been fixed.
- Manually delete bin folders: (if cleanup / rebuild did not work)
5.1 If you are afraid, back up the entire source directory. After everything works, delete the backup ...
5.2 manually go to the dependent projects (which are indicated in the project "wrong code") and in each of them go to obj and the bin folder and delete everything that was automatically created from there - in other words, everything that you did not put there manually . This is usually all. Don't worry, the visual studio will re-create the Debug and Release catalogs and populate them.
Remove obj and bin of your project.
Restore everything.
source share