mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-12 03:57:32 +00:00
fix: Reflection - throw inner exception for parameterless constructors that throw exceptions
This commit is contained in:
parent
5700cf4ce2
commit
6af3e5b2ff
1 changed files with 3 additions and 2 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue