I use Activator.CreateInstance to create class from Type. In case where constructor throws exception (That happens and is totally expected) it is caught by try..catch.
But Visual Studio breaks as if it was unhandled.
I managed to simplify this issue:
Screenshot of VS
Code in Tio
using System;
public class Program
{
public static void Main()
{
try {
var foo = Activator.CreateInstance(typeof(Foo));
catch {}
Console.WriteLine("Finished");
}
class Foo {
public Foo() {
throw new Exception();
}
}
}
If that's important I use Visual Studio 2019