Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Harvey <dharvey@microsoft.com>2017-07-14 21:05:04 +0300
committerDaniel Harvey <dharvey@microsoft.com>2017-07-14 21:05:04 +0300
commitaad567bc7b3965f4d10e7d5129fce833e5461c24 (patch)
treee90005fa5fb845938e81b83163945433153e68d2 /src/Runtime.Base
parent4eff7d02c1b2f49afeba46127a2a6f086ed6748f (diff)
Makes exception dispatch call into AppContext to enable FirstChanceException. We're supposed to pass in an AppDomain as sender, but completing that will require a CoreFX change to pass in an AppDomain we can use.
[tfs-changeset: 1666024]
Diffstat (limited to 'src/Runtime.Base')
-rw-r--r--src/Runtime.Base/src/System/Runtime/ExceptionHandling.cs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/Runtime.Base/src/System/Runtime/ExceptionHandling.cs b/src/Runtime.Base/src/System/Runtime/ExceptionHandling.cs
index aaf0cc33d..2b7fe6c75 100644
--- a/src/Runtime.Base/src/System/Runtime/ExceptionHandling.cs
+++ b/src/Runtime.Base/src/System/Runtime/ExceptionHandling.cs
@@ -155,6 +155,7 @@ namespace System.Runtime
AppendExceptionStackFrame = 3,
CheckStaticClassConstruction = 4,
GetSystemArrayEEType = 5,
+ OnFirstChance = 6,
}
// Given an address pointing somewhere into a managed module, get the classlib-defined fail-fast
@@ -211,6 +212,25 @@ namespace System.Runtime
#endif
}
+ private static void OnFirstChanceExceptionViaClassLib(object exception)
+ {
+ IntPtr pOnFirstChanceFunction =
+ (IntPtr)InternalCalls.RhpGetClasslibFunctionFromEEtype((IntPtr)exception.m_pEEType, ClassLibFunctionId.OnFirstChance);
+
+ if (pOnFirstChanceFunction == IntPtr.Zero)
+ {
+ return;
+ }
+
+ try
+ {
+ CalliIntrinsics.CallVoid(pOnFirstChanceFunction, exception);
+ }
+ catch
+ {
+ // disallow all exceptions leaking out of callbacks
+ }
+ }
[MethodImpl(MethodImplOptions.NoInlining)]
internal static unsafe void UnhandledExceptionFailFastViaClasslib(
@@ -647,7 +667,10 @@ namespace System.Runtime
bool isValid = frameIter.Init(exInfo._pExContext, (exInfo._kind & ExKind.InstructionFaultFlag) != 0);
Debug.Assert(isValid, "RhThrowEx called with an unexpected context");
+
+ OnFirstChanceExceptionViaClassLib(exceptionObj);
DebuggerNotify.BeginFirstPass(exceptionObj, frameIter.ControlPC, frameIter.SP);
+
for (; isValid; isValid = frameIter.Next(out startIdx, out unwoundReversePInvoke))
{
// For GC stackwalking, we'll happily walk across native code blocks, but for EH dispatch, we