fix: Preserve stack trace when rethrowing inner exceptions

This commit is contained in:
Chris Cameron
2021-03-12 14:03:47 -05:00
parent d1f8096933
commit a55480f8e5

View File

@@ -4,6 +4,7 @@ using System.Collections.Generic;
using Crestron.SimplSharp.Reflection;
#else
using System.Reflection;
using System.Runtime.ExceptionServices;
#endif
using ICD.Common.Properties;
using Newtonsoft.Json;
@@ -54,7 +55,12 @@ namespace ICD.Common.Utils.Json
}
catch (TargetInvocationException e)
{
throw e.InnerException;
#if SIMPLSHARP
throw e.InnerException ?? e;
#else
ExceptionDispatchInfo.Capture(e.InnerException ?? e).Throw();
throw;
#endif
}
}