# Visual Studio 2010 debugging problem



## shuggans (Aug 31, 2011)

I have a strange issue someone may have come across before.

Usually when running my code in debugging mode (clicking "play"), anytime the program crashes, visual studio lets me know why, even highlights the line the problem is at.  

However the past couple of days, when an app crashes, it simply closes and that's it.  No information is given at all.

Any ideas?


----------



## xbonez (Aug 31, 2011)

I might be terribly mistaken on this, but I believe when your program crashes, it shows you the error only if you're catching an exception. I'm almost certain I'm wrong on this...lol.

Either ways, try setting breakpoints to zero in on the problem code.


----------



## FordGT90Concept (Aug 31, 2011)

a) Make sure you are running in debug mode.
b) Are you certain your application isn't terminating peacefully?  For example, console applications do this if nothing is keeping them alive (like a ReadKey() or an infinite loop).
c) Generic, untraceable crashes can occur when using unmanaged code.  For example, if you are using a 3rd party DLL, it can be causing a crash outside of the managed code so your program simply closes.
d) ErrorLevel is set too low in Visual Studio.
e) An anti-virus or some other program is terminating it after it starts and not reporting that it did.


----------



## shuggans (Aug 31, 2011)

Thanks for the replies guys, I'll try and look at all this when I get home from work today.  I'll let you know.


----------



## shuggans (Aug 31, 2011)

xbonez said:


> I might be terribly mistaken on this, but I believe when your program crashes, it shows you the error only if you're catching an exception. I'm almost certain I'm wrong on this...lol.
> 
> Either ways, try setting breakpoints to zero in on the problem code.



Before, It would show where the crash happened without me setting up a try/catch.  I jsut don't understand what changed.  Never had to set break points either.


----------



## GSquadron (Aug 31, 2011)

Did you change anything in the environment settings?
Did you install a program before the problem happened?

*To reset your settings*

On the _Tools menu_, click _Import and Export Settings_.

On the _Welcome to the Import and Export Settings Wizard page_, click _Reset all settings_ and then click _Next_.

If you want to save your current settings combination, click _Yes_, _save my current settings_, specify a file name, and then click _Next_.

—or—

If you want to delete your current settings combination, choose _No_, _just reset settings_, _overwriting my current settings_, and then click _Next_. This option does not delete default settings, which will still be available the next time you use the wizard.

In Which collection of settings do you want to reset to, select a settings collection from the list.

Click _Finish_.

The _Reset Complete page_ alerts you to any problems encountered during the reset.


----------



## Kreij (Aug 31, 2011)

I had a problem with VS one time where the the debugger started doing strange things, but only in a particular project.
It turned out that the solution files got corrupted.
I had to create another project and import (add->existing) all of the code files to the new projects. After that it worked just fine.
Something to try if nothing else works for you.



xbonez said:


> I might be terribly mistaken on this, but I believe when your program crashes, it shows you the error only if you're catching an exception. I'm almost certain I'm wrong on this...lol.



You are correct in that you are wrong 
The debugger catches unhandled exceptions and runtime errors. 
Try/Catch blocks are so you can handle the exceptions gracefully (or not so gracefully. lol)
As Ford noted, though, there are cetain conditions where the debugger has no clue what to do so it just kills the running process.

If you are running outside of the debugger, the OS will throw an exception, but it too just kills the process under certain conditions.

When both the debugger and the OS fail to throw an exception, the first thing that usually happens is the developer/coder yells, WTF!
This can be embarassing if you are at work or writing code in your church's computer room and the Pastor just walked in.


----------

