summaryrefslogtreecommitdiff
path: root/src/vm/appdomain.cpp
diff options
context:
space:
mode:
authorKoundinya Veluri <kouvel@microsoft.com>2017-07-24 13:17:16 -0700
committerGitHub <noreply@github.com>2017-07-24 13:17:16 -0700
commit94d374d22c1bb2b4815a05b5049f39d9b78de9cd (patch)
tree1def700b54fa9d14dbd58a938e761e347bf70146 /src/vm/appdomain.cpp
parent6747fa19a30992f9efbf3eab5130e25b80e79686 (diff)
downloadcoreclr-94d374d22c1bb2b4815a05b5049f39d9b78de9cd.tar.gz
coreclr-94d374d22c1bb2b4815a05b5049f39d9b78de9cd.tar.bz2
coreclr-94d374d22c1bb2b4815a05b5049f39d9b78de9cd.zip
Don't call AssemblyResolve event for CoreLib resources (#12999)
* Don't call AssemblyResolve event for CoreLib resources Part of fix for #12668: - CoreLib resource lookup should not raise the AssemblyResolve event because a misbehaving handler could cause an infinite recursion check and fail-fast to be triggered when the resource is not found, as the issue would repeat when reporting that error - A handler could misbehave by returning an assembly that does not match the requested identity or by throwing * Address feedback
Diffstat (limited to 'src/vm/appdomain.cpp')
-rw-r--r--src/vm/appdomain.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/vm/appdomain.cpp b/src/vm/appdomain.cpp
index 946009ac06..a4499395bf 100644
--- a/src/vm/appdomain.cpp
+++ b/src/vm/appdomain.cpp
@@ -7078,18 +7078,26 @@ EndTry2:;
}
else if (!fIsWellKnown)
{
- // Trigger the resolve event also for non-throw situation.
- // However, this code path will behave as if the resolve handler has thrown,
- // that is, not trigger an MDA.
_ASSERTE(fThrowOnFileNotFound == FALSE);
- AssemblySpec NewSpec(this);
- AssemblySpec *pFailedSpec = NULL;
+ // Don't trigger the resolve event for the CoreLib satellite assembly. A misbehaving resolve event may
+ // return an assembly that does not match, and this can cause recursive resource lookups during error
+ // reporting. The CoreLib satellite assembly is loaded from relative locations based on the culture, see
+ // AssemblySpec::Bind().
+ if (!pSpec->IsMscorlibSatellite())
+ {
+ // Trigger the resolve event also for non-throw situation.
+ // However, this code path will behave as if the resolve handler has thrown,
+ // that is, not trigger an MDA.
+
+ AssemblySpec NewSpec(this);
+ AssemblySpec *pFailedSpec = NULL;
- fForceReThrow = TRUE; // Managed resolve event handler can throw
+ fForceReThrow = TRUE; // Managed resolve event handler can throw
- // Purposly ignore return value
- PostBindResolveAssembly(pSpec, &NewSpec, hrBindResult, &pFailedSpec);
+ // Purposly ignore return value
+ PostBindResolveAssembly(pSpec, &NewSpec, hrBindResult, &pFailedSpec);
+ }
}
}
}