fix: Reflection - throw inner exception for parameterless constructors that throw exceptions

This commit is contained in:
Drew Tingen
2019-08-07 13:24:06 -04:00
parent 5700cf4ce2
commit 6af3e5b2ff

View File

@@ -220,14 +220,15 @@ namespace ICD.Common.Utils
if (parameters == null)
throw new ArgumentNullException("parameters");
try
{
if (parameters.Length == 0)
return Activator.CreateInstance(type);
ConstructorInfo constructor = GetConstructor(type, parameters);
try
{
return constructor.Invoke(parameters);
}
catch (TypeLoadException e)