Search code examples
javascriptvisual-studiodebuggingvisual-studio-2013visual-studio-debugging

Debugging Visual Studio web application in Release Mode


I have a Visual Studio 2013 Web Application project that breaks when in Release mode. No console errors are thrown and I think that it must have something to do with script minifying/concatenating. Everything's fine when I build in Debug Mode.

So I'm trying to figure out how to debug when in Release mode and having no luck.

Most articles, like this one, suggest modifying C/C++, Linker and other properties... but I don't have see those options, I assume because I'm working on a web app project.

project properties

Are there other ways I can enable debugging, break points, console.logs, etc in Release Mode?


Solution

  • If you're trying to debug a web application then no you're not going to see those options, as they're only available for C++ solutions. To debug a C# or VB web application you need shouldn't need to do any special configuration.

    If it's not working however there are some simple things you can check, firstly that the PDB files are generated. These are essentially debug symbols that match the original source code up to the compiled output, allowing visual studio to step through the code and they should be placed in the same directory as your DLLs.

    enter image description here

    Once you've got your PDB in place all you need to do is attach the debugger. Now for a web application this can be a little confusing at first (if you're using IIS). IIS has several application pools:

    enter image description here

    The IIS process that you want to attatch to is called w3wp which is a little confusing at first. And potentially there are several of them (one for each AppPool that is active and running). Make sure you've got the Show processes from all users checked to see the processes listed:

    enter image description here

    To make this whole process easier, if you're running a version of Visual Studio that allows extensions take a look at AttatchTo. It adds a menu option you can click (and convert to a toolbar button/shortcut) that will automatically attach to all the IIS instances to debug your code.