diff --git a/ICD.Common.Utils/Utils/ReflectionUtils.cs b/ICD.Common.Utils/Utils/ReflectionUtils.cs index 08656c9..4be7a4c 100644 --- a/ICD.Common.Utils/Utils/ReflectionUtils.cs +++ b/ICD.Common.Utils/Utils/ReflectionUtils.cs @@ -186,7 +186,7 @@ namespace ICD.Common.Utils public static T CreateInstance() where T : new() { - return Activator.CreateInstance(); + return (T)CreateInstance(typeof(T)); } /// @@ -198,7 +198,14 @@ namespace ICD.Common.Utils if (type == null) throw new ArgumentNullException("type"); - return Activator.CreateInstance(type); + try + { + return Activator.CreateInstance(type); + } + catch (TargetInvocationException e) + { + throw e.GetBaseException(); + } } ///