Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2012 RC breaks on exceptions from within the .NET Framework. How do I make it break on exceptions only in my code?

When debugging using Visual Studio 2012 RC with break on exception turned on, Visual Studio breaks on exceptions from within the .NET Framework. How do I make it break on exceptions only in my code?

When debugging a ASP.NET MVC 4 project there are a lot of framework exceptions thrown on every page hit. The following exception happens a lot:

System.Globalization.CultureNotFoundException occurred
  HResult=-2147024809
  Message=Culture is not supported.
Parameter name: name
UserCache is an invalid culture identifier.
  Source=mscorlib
  ParamName=name
  InvalidCultureName=UserCache
  StackTrace:
       at System.Globalization.CultureInfo..ctor(String name, Boolean useUserOverride)
  InnerException: 

This exception is coming from within mscorlib.dll which I do not not want Visual Studio to break on.

It looks like I am missing a column in the exceptions window. I only see the "Thrown" column and "User-Unhandled" is missing. This might be my issue.

like image 248
KTrace Avatar asked Jul 31 '12 14:07

KTrace


People also ask

How do I turn off exceptions in Visual Studio?

In this article When the debugger breaks, it shows you where the exception was thrown. You can also add or delete exceptions. With a solution open in Visual Studio, use Debug > Windows > Exception Settings to open the Exception Settings window.

What is exception settings Visual Studio?

In Visual Studio, you can use Exception Settings Window to manage the exceptions – for which exception to break, at which point to break, to add or deleting exceptions. The Exception Settings windows for Visual Studio is there for quite some time.


1 Answers

I believe all you need to do is go to

Debug -> Options -> Debugging and check Enable Just My Code (Managed Only)

like image 132
Malcolm O'Hare Avatar answered Sep 20 '22 16:09

Malcolm O'Hare