fix: Hack to catch System.Reflection constructor invocation exceptions on crestron

This commit is contained in:
Chris Cameron
2020-05-04 18:36:59 -04:00
parent dd3c6b13fd
commit bbb09666dd

View File

@@ -209,13 +209,17 @@ namespace ICD.Common.Utils
ConstructorInfo constructor = GetConstructor(type, parameters);
return constructor.Invoke(parameters);
}
catch (TypeLoadException e)
catch (Exception e)
{
throw e.GetBaseException();
}
catch (TargetInvocationException e)
{
throw e.GetBaseException();
// Crestron sandbox doesn't let us reference System.Reflection types...
switch (e.GetType().Name)
{
case "TypeLoadException":
case "TargetInvocationException":
throw e.GetBaseException();
}
throw;
}
}