mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-12 12:07:05 +00:00
Re-throwing inner exception from Activator.CreateInstance()
This commit is contained in:
parent
a802528fed
commit
1927c7df9f
1 changed files with 9 additions and 2 deletions
|
|
@ -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>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue