Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2015 project no longer runs in debug mode

This is what I get even when I run in the Debug configuration:

The way I got this to show was by enabling "Just My Code" and warn if there isn't any user code on launch. This is something that recently happened to our project, and I'm not sure what we did to cause this. But I've been unable to fix it. Breakpoints won't fire and quick watch gives weird results.

I've tried googling the issue, but none of the standard "break points won't fire" solutions have worked. I'm all out of ideas.

I've checked the configuration manager and every project is also set to Debug there as well.

Enter image description here

I turned off "Enable Optimaizations", and I no longer get the "you are debugging a Release build" dialog. It runs and stops on breakpoints again! However the output window displays this at start up:

Symbols for the module 'Navigo.exe' were not loaded.

  1. Use a debug build configuration or disable the debug option 'Enable Just My Code'.
  2. Check the 'Symbols' settings under debugging options.

So this solves my primary problem of no longer being able to use breakpoints and the popup. Which is odd since I thought you needed symbols to be loaded for breakpoints to work. So how can the breakpoints work if the symbols aren't loaded? Maybe it's just a bad message?

like image 233
Sen Avatar asked Aug 13 '15 15:08

Sen


People also ask

Why can't I start debugging in Visual Studio?

Go to Solution Explorer, right-click your project go to properties, click Debug, at the bottom there is a check box, un-check the check box that states 'Enable the Visual Studio hosting process'.

How do I fix the Debug executable in Visual Studio?

Just use File/Open Project/Solution, select EXE file and Open it. Then select Debug/Start debugging. The other option is to run the EXE first and then Select Debug/Attach to process.

How do I keep Debug code in Visual Studio?

To run or debug a simple app in VS Code, select Run and Debug on the Debug start view or press F5 and VS Code will try to run your currently active file. However, for most debugging scenarios, creating a launch configuration file is beneficial because it allows you to configure and save debugging setup details.


2 Answers

Use the Configuration Manager to check what the actual settings are for the Debug configuration - it's at menu BuildConfiguration Manager... - in case they are set to use Release:

Configuration Manager

Also, make sure the project is defining DEBUG correctly, and that "Optimize Code" is not checked:

Properties

like image 200
stuartd Avatar answered Sep 22 '22 23:09

stuartd


This has happened to me on a couple of projects too. I reviewed my build settings, as suggested by stuartd. However, 'Optimize code' was not enabled in my build settings. So I enabled it and saved the project. Then I unchecked it and saved again. Problem solved.

There's some kind of bug that causes the --optimize+ flag to be passed to the debugger. Enabling it and then disabling it is an easy workaround until the bug is fixed.

like image 26
Adam J. Avatar answered Sep 22 '22 23:09

Adam J.