mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-01-11 19:44:55 +00:00
Re-throwing inner exception from Activator.CreateInstance()
This commit is contained in:
@@ -186,7 +186,7 @@ namespace ICD.Common.Utils
|
|||||||
public static T CreateInstance<T>()
|
public static T CreateInstance<T>()
|
||||||
where T : new()
|
where T : new()
|
||||||
{
|
{
|
||||||
return Activator.CreateInstance<T>();
|
return (T)CreateInstance(typeof(T));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -198,7 +198,14 @@ namespace ICD.Common.Utils
|
|||||||
if (type == null)
|
if (type == null)
|
||||||
throw new ArgumentNullException("type");
|
throw new ArgumentNullException("type");
|
||||||
|
|
||||||
return Activator.CreateInstance(type);
|
try
|
||||||
|
{
|
||||||
|
return Activator.CreateInstance(type);
|
||||||
|
}
|
||||||
|
catch (TargetInvocationException e)
|
||||||
|
{
|
||||||
|
throw e.GetBaseException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user