Prevent Visual Studio from breaking on unhandled exceptions
Apparently, this was a bug in Visual Studio. Installing the later updates has fixed it.
Visual Studio not breaking on user-unhandled exceptions
Debug->Exceptions->Check Thrown/User-Unhandled
for Common Language Runtime Exceptions
edit: Maybe try to do a clean/rebuild, and run again? Maybe debug symbols are corrupt or something..
Visual Studio: How to break on handled exceptions?
With a solution open, go to the Debug - Windows - Exception Settings (Ctrl+Alt+E) menu option. From there you can choose to break on Thrown or User-unhandled exceptions.
EDIT: My instance is set up with the C# "profile" perhaps it isn't there for other profiles?
How do I make Visual Studio 2015 ignore handled exceptions?
So it turns out this is a known issue when using NUnit testing. NUnit essentially has a giant try/catch around your code, so VS thinks it's handled.
See this question: Why doesn't Visual Studio break on exceptions when debugging unit tests?
Visual Studio 2015 unexpectedly breaking on handled exceptions
There is a special case for this exception, which I am guessing applies here. From the docs:
AccessViolationException and try/catch blocks
Starting with the .NET Framework 4, AccessViolationException exceptions thrown by the common language runtime are not handled by the catch statement in a structured exception handler if the exception occurs outside of the memory reserved by the common language runtime. To handle such an AccessViolationException exception, you should apply the HandleProcessCorruptedStateExceptionsAttribute attribute to the method in which the exception is thrown. This change does not affect AccessViolationException exceptions thrown by user code, which can continue to be caught by a catch statement. For code written for previous versions of the .NET Framework that you want to recompile and run without modification on the .NET Framework 4, you can add the element to your app's configuration file. Note that you can also receive notification of the exceptions if you have defined a handler for the AppDomain.FirstChanceException or AppDomain.UnhandledException event.
As the docs say, the solution is to add the HandleProcessCorruptedStateExceptionsAttribute to the Start()
method. If not possible (e.g., this is supplied via a library), I'm guessing you can add a method that wraps the call and add the attribute to that wrapping method.
Break on any thrown exception in Xamarin
Go into Debug > Windows > Exception Settings and check the "Break when thrown" box against Common Language Runtime Exceptions.
You may get a lot of noise this way though, as this will also break on exceptions thrown in libraries or inside the framework itself.
Visual Studio 2015 debugger stops for a handled exception of a DebuggerHidden function
You could use the DebuggerNonUserCode Attribute instead of the DebuggerStepThrough or DebuggerHidden attribute in VS2015 since there are a few small differences between them:
https://blogs.msdn.microsoft.com/visualstudioalm/2016/02/12/using-the-debuggernonusercode-attribute-in-visual-studio-2015/
Update:
I get the same issue as yours using the VS2015. I found that it would be related to on debugging option, please enable the option "Use Managed Compatibility Mode" under TOOLS->Options->Debugging. Debug it again.
Related Topics
In C#, Is "This" Keyword Required
How to Delete a Row from Gridview
When Not to Use Yield (Return)
Using C# to Search a CSV File and Pull the Value in the Column Next to It
How to Know What Image Format I Get from a Stream
Change Custom Attribute's Parameter at Runtime
Testing Smtp Server Is Running via C#
How to Update an Existing Windows Phone 8 App to Windows Phone Store 8.1
Database.Begintransaction VS Transactions.Transactionscope
C# Flickering Listview on Update
Closures Behaving Differently in for and Foreach Loops
Visual Studio Installer > How to Launch App at End of Installer
Find Image Format Using Bitmap Object in C#
How to Simulate a Mouse Click at a Certain Position on the Screen
How to Iterate Through a Datatable
In .Net 4.0, How to 'Sandbox' an In-Memory Assembly and Execute a Method