From 2454c1323d82520bc87f9e356faaaeaa44909667 Mon Sep 17 00:00:00 2001 From: Luqun Lou Date: Wed, 10 Jun 2015 15:53:48 -0700 Subject: [PATCH] Fix Exception Propagation issue for NetCoreForCoreCLR Non-AppX case Currently in CoreCLR, We don't propagate managed exception from Managed->Native->Managed correctly for non-appx case--- if you throw a managed exception, then during M->N, the managed exception is stored in thread, later during N->M, we will try to fetch this stored exception if it is managed exception by checking IsManagedObject() The logical for IsManagedObject should be just check its IUnknown slots first no matter whether it is appx or not; If doesn't match, try to QI IManagedObject. [tfs-changeset: 1486094] --- src/vm/interoputil.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/vm/interoputil.cpp b/src/vm/interoputil.cpp index ca668c5..6f672c0 100644 --- a/src/vm/interoputil.cpp +++ b/src/vm/interoputil.cpp @@ -549,17 +549,15 @@ BOOL IsManagedObject(IUnknown *pIUnknown) } CONTRACTL_END; - if (AppX::IsAppXProcess()) + //Check based on IUnknown slots, i.e. we'll see whether the IP maps to a CCW. + if (MapIUnknownToWrapper(pIUnknown) != NULL) { - //In AppX we don't support IManagedObject so we'll do the check based on - //IUnknown slots, i.e. we'll see whether the IP maps to a CCW. - if (MapIUnknownToWrapper(pIUnknown) != NULL) - { - // We found an existing CCW hence this is a managed exception. - return TRUE; - } + // We found an existing CCW hence this is a managed exception. + return TRUE; } - else + + // QI IManagedObject. Note AppX doesn't support IManagedObject + if (!AppX::IsAppXProcess()) { SafeComHolder pManagedObject = NULL; HRESULT hrLocal = SafeQueryInterface(pIUnknown, IID_IManagedObject, (IUnknown**)&pManagedObject); -- 2.7.4