Maybe I’m missing something but why does visual studio break execution to tell me an exception has occured even though its handled?
Yes, unchecking user-unhandled exception fixes the problem, but why is a handled exception being called a unhandled exception?
Lazy<int> lazyCount = new Lazy<int>(() => { throw new NotImplementedException(); }, System.Threading.LazyThreadSafetyMode.None);
Func<int> valueGenerator = () => { throw new NotImplementedException(); };
try
{
int value = lazyCount.Value;
}
catch (NotImplementedException e)
{
Console.WriteLine("Breaks");
}
try
{
int value = valueGenerator();
}
catch (NotImplementedException e)
{
Console.WriteLine("Doesn't Breaks");
}
try
{
throw new NotImplementedException();
}
catch (NotImplementedException e)
{
Console.WriteLine("Doesn't break");
}
Console.ReadLine();
If you’re annoyed by the dialog I would recommend disabling the Exception Assistant (I’m not sure what it is assisting).
Under this options menu you can disable the Exception Assistant, and control various other debugging features (Just My Code, etc).
As @Michael Kennedy noted you can goto
Debug -> Exception...(also Ctrl+Alt+E), clickFindand uncheck Thrown for the offending exception.