Question Why won't some apps debug?

Joined
Sep 16, 2023
Messages
21
Programming Experience
10+
WHAT I HAVE:
Visual Basic 2019, .NET Framework 4.6+

MY PROBLEM:
Recently, my WinForms and Console apps--which ran fine before--refused to debug/run in the IDE. At first, the problem was that they would build and then abort (without executing a single statement), saying, "Program exited with code 0 (0x0)" in the Output window; I found that for many of them, turning on "Use Managed Compatibility Mode" solved the problem and enabled them to run. However (!!), some--and only some--programs still refuse to debug; they build and then mysteriously abort without any error message and without any exit message in the Output window! I tried toggling the managed-compatibility-mode option off and on again, cleaning and rebuilding the solution, exiting and restarting Visual Studio--and nothing worked for these programs. Other apps run fine now, but some refuse to debug if I change them; others debug fine even when changes are made. Also, when I create an all-new program, it won't debug.

What's going on?!
 
Last edited:
It's hard to say what exactly is happening but it sounds like VS is corrupt in some way. I would suggest performing a Repair, which is a specific option in the VS Installer. That should hopefully overwrite any corrupt files and fix your issue. It's possible that some projects have been damaged and would need specific measures to repair them. If you can't determine the nature of the damage, it may be quicker to simply create a new project and copy in the source files.

Note that this is an example of why it's good to use source control. If projects have been damaged, you'd be able to roll back to a last known good state and correct any damage without having to know what it was. The history may also be able to show you what the damage was. If you're not already doing so, I suggest that you start using some form of source control, e.g. Azure DevOps or GitHub.
 
Back
Top