From 6af3e5b2ff76215baf609fd1954fb72d4456e77c Mon Sep 17 00:00:00 2001 From: Drew Tingen Date: Wed, 7 Aug 2019 13:24:06 -0400 Subject: [PATCH] fix: Reflection - throw inner exception for parameterless constructors that throw exceptions --- ICD.Common.Utils/ReflectionUtils.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ICD.Common.Utils/ReflectionUtils.cs b/ICD.Common.Utils/ReflectionUtils.cs index 630d231..4ca7955 100644 --- a/ICD.Common.Utils/ReflectionUtils.cs +++ b/ICD.Common.Utils/ReflectionUtils.cs @@ -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)