mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-16 13:15:07 +00:00
fix: Reflection - throw inner exception for parameterless constructors that throw exceptions
This commit is contained in:
@@ -220,14 +220,15 @@ namespace ICD.Common.Utils
|
|||||||
|
|
||||||
if (parameters == null)
|
if (parameters == null)
|
||||||
throw new ArgumentNullException("parameters");
|
throw new ArgumentNullException("parameters");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
if (parameters.Length == 0)
|
if (parameters.Length == 0)
|
||||||
return Activator.CreateInstance(type);
|
return Activator.CreateInstance(type);
|
||||||
|
|
||||||
ConstructorInfo constructor = GetConstructor(type, parameters);
|
ConstructorInfo constructor = GetConstructor(type, parameters);
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return constructor.Invoke(parameters);
|
return constructor.Invoke(parameters);
|
||||||
}
|
}
|
||||||
catch (TypeLoadException e)
|
catch (TypeLoadException e)
|
||||||
|
|||||||
Reference in New Issue
Block a user