mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-16 13:15:07 +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,8 +198,15 @@ namespace ICD.Common.Utils
|
|||||||
if (type == null)
|
if (type == null)
|
||||||
throw new ArgumentNullException("type");
|
throw new ArgumentNullException("type");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
return Activator.CreateInstance(type);
|
return Activator.CreateInstance(type);
|
||||||
}
|
}
|
||||||
|
catch (TargetInvocationException e)
|
||||||
|
{
|
||||||
|
throw e.GetBaseException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the custom attributes added to the given assembly.
|
/// Gets the custom attributes added to the given assembly.
|
||||||
|
|||||||
Reference in New Issue
Block a user