mirror of
https://github.com/soukoku/ntwain.git
synced 2026-02-25 13:04:07 +08:00
Tweaked exception rethrow code.
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Runtime.ExceptionServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@@ -18,9 +19,13 @@ namespace NTwain.Internals
|
|||||||
{
|
{
|
||||||
if (ex != null)
|
if (ex != null)
|
||||||
{
|
{
|
||||||
|
#if NET40
|
||||||
typeof(Exception).GetMethod("PrepForRemoting",
|
typeof(Exception).GetMethod("PrepForRemoting",
|
||||||
BindingFlags.NonPublic | BindingFlags.Instance)?.Invoke(ex, new object[0]);
|
BindingFlags.NonPublic | BindingFlags.Instance)?.Invoke(ex, new object[0]);
|
||||||
throw ex;
|
throw ex;
|
||||||
|
#else
|
||||||
|
ExceptionDispatchInfo.Capture(ex).Throw();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user