In earlier versions of Visual Studio you could use the [DebuggerStepThrough] attribute to ignore exception in a special method which for some reason cannot be avoided (network exceptions e.g. or maybe failing parsings). (See this Thread: Don't stop debugger at THAT exception when it's thrown and caught)
Now Visual Studio shows me the exception at the calling function without the attribute even though it's already caught and processed.
Example:
static void Main(string[] args)
{
ExceptionalMethod();
}
[DebuggerStepThrough]
static void ExceptionalMethod()
{
try
{
throw new Exception("BAM");
}
catch
{ }
}
This code should not stop in VS 2013 or lower. Same behaviour with DebuggerHidden.
Is there a new trick to ignore that very one exception? Without ignoring all exceptions of that type of course?
Microsoft deactivated the feature due to "beneficial performance improvement when debugging .NET code".
In Visual Studio 2015 Update 2 it's possible to turn the feature on/the performance improvement off by changing a registry key.
Enter this into your command line to do that:
Source: https://blogs.msdn.microsoft.com/visualstudioalm/2016/02/12/using-the-debuggernonusercode-attribute-in-visual-studio-2015/