@@ -3365,17 +3365,12 @@ void AppDomain::RaiseLoadingAssemblyEvent(Assembly *pAssembly)
33653365 } gc;
33663366 gc.orThis = NULL ;
33673367
3368- ARG_SLOT args[1 ];
33693368 GCPROTECT_BEGIN (gc);
33703369
33713370 gc.orThis = pAssembly->GetExposedObject ();
33723371
3373- MethodDescCallSite onAssemblyLoad (METHOD__ASSEMBLYLOADCONTEXT__ON_ASSEMBLY_LOAD);
3374-
3375- // GetExposedAssemblyObject may cause a gc, so call this before filling args[0]
3376- args[0 ] = ObjToArgSlot (gc.orThis );
3377-
3378- onAssemblyLoad.Call (args);
3372+ UnmanagedCallersOnlyCaller onAssemblyLoad (METHOD__ASSEMBLYLOADCONTEXT__ON_ASSEMBLY_LOAD);
3373+ onAssemblyLoad.InvokeThrowing (&gc.orThis );
33793374
33803375 GCPROTECT_END ();
33813376 }
@@ -3654,34 +3649,27 @@ Assembly* AppDomain::RaiseTypeResolveEventThrowing(Assembly* pAssembly, LPCSTR s
36543649
36553650 struct {
36563651 ASSEMBLYREF AssemblyRef;
3657- STRINGREF str ;
3652+ ASSEMBLYREF ResultRef ;
36583653 } gc;
36593654 gc.AssemblyRef = NULL ;
3660- gc.str = NULL ;
3655+ gc.ResultRef = NULL ;
36613656
36623657 GCPROTECT_BEGIN (gc);
36633658
36643659 if (pAssembly != NULL )
36653660 gc.AssemblyRef = (ASSEMBLYREF)pAssembly->GetExposedObject ();
36663661
3667- MethodDescCallSite onTypeResolve (METHOD__ASSEMBLYLOADCONTEXT__ON_TYPE_RESOLVE);
3668-
3669- gc.str = StringObject::NewString (szName);
3670- ARG_SLOT args[2 ] =
3671- {
3672- ObjToArgSlot (gc.AssemblyRef ),
3673- ObjToArgSlot (gc.str )
3674- };
3675- gc.AssemblyRef = (ASSEMBLYREF) onTypeResolve.Call_RetOBJECTREF (args);
3662+ UnmanagedCallersOnlyCaller onTypeResolve (METHOD__ASSEMBLYLOADCONTEXT__ON_TYPE_RESOLVE);
3663+ onTypeResolve.InvokeThrowing (&gc.AssemblyRef , szName, &gc.ResultRef );
36763664
3677- if (gc.AssemblyRef != NULL )
3665+ if (gc.ResultRef != NULL )
36783666 {
3679- _ASSERTE (CoreLibBinder::IsClass (gc.AssemblyRef ->GetMethodTable (), CLASS__ASSEMBLY));
3667+ _ASSERTE (CoreLibBinder::IsClass (gc.ResultRef ->GetMethodTable (), CLASS__ASSEMBLY));
36803668
3681- pResolvedAssembly = gc.AssemblyRef ->GetAssembly ();
3669+ pResolvedAssembly = gc.ResultRef ->GetAssembly ();
36823670
36833671 if (pResultingAssemblyRef)
3684- *pResultingAssemblyRef = gc.AssemblyRef ;
3672+ *pResultingAssemblyRef = gc.ResultRef ;
36853673 else
36863674 {
36873675 if (pResolvedAssembly->IsCollectible ())
@@ -3714,29 +3702,23 @@ Assembly* AppDomain::RaiseResourceResolveEvent(Assembly* pAssembly, LPCSTR szNam
37143702
37153703 struct {
37163704 ASSEMBLYREF AssemblyRef;
3717- STRINGREF str ;
3705+ ASSEMBLYREF ResultRef ;
37183706 } gc;
37193707 gc.AssemblyRef = NULL ;
3720- gc.str = NULL ;
3708+ gc.ResultRef = NULL ;
37213709
37223710 GCPROTECT_BEGIN (gc);
37233711
37243712 if (pAssembly != NULL )
37253713 gc.AssemblyRef =(ASSEMBLYREF)pAssembly->GetExposedObject ();
37263714
3727- MethodDescCallSite onResourceResolve (METHOD__ASSEMBLYLOADCONTEXT__ON_RESOURCE_RESOLVE);
3728- gc.str = StringObject::NewString ( szName);
3729- ARG_SLOT args[ 2 ] =
3715+ UnmanagedCallersOnlyCaller onResourceResolve (METHOD__ASSEMBLYLOADCONTEXT__ON_RESOURCE_RESOLVE);
3716+ onResourceResolve. InvokeThrowing (& gc.AssemblyRef , szName, &gc. ResultRef );
3717+ if (gc. ResultRef != NULL )
37303718 {
3731- ObjToArgSlot (gc.AssemblyRef ),
3732- ObjToArgSlot (gc.str )
3733- };
3734- gc.AssemblyRef = (ASSEMBLYREF) onResourceResolve.Call_RetOBJECTREF (args);
3735- if (gc.AssemblyRef != NULL )
3736- {
3737- _ASSERTE (CoreLibBinder::IsClass (gc.AssemblyRef ->GetMethodTable (), CLASS__ASSEMBLY));
3719+ _ASSERTE (CoreLibBinder::IsClass (gc.ResultRef ->GetMethodTable (), CLASS__ASSEMBLY));
37383720
3739- pResolvedAssembly = gc.AssemblyRef ->GetAssembly ();
3721+ pResolvedAssembly = gc.ResultRef ->GetAssembly ();
37403722 if (pResolvedAssembly->IsCollectible ())
37413723 {
37423724 COMPlusThrow (kNotSupportedException , W (" NotSupported_CollectibleAssemblyResolve" ));
@@ -3778,10 +3760,10 @@ AppDomain::RaiseAssemblyResolveEvent(
37783760
37793761 struct {
37803762 ASSEMBLYREF AssemblyRef;
3781- STRINGREF str ;
3763+ ASSEMBLYREF ResultRef ;
37823764 } gc;
37833765 gc.AssemblyRef = NULL ;
3784- gc.str = NULL ;
3766+ gc.ResultRef = NULL ;
37853767
37863768 GCPROTECT_BEGIN (gc);
37873769 {
@@ -3790,21 +3772,14 @@ AppDomain::RaiseAssemblyResolveEvent(
37903772 gc.AssemblyRef =(ASSEMBLYREF)pSpec->GetParentAssembly ()->GetExposedObject ();
37913773 }
37923774
3793- MethodDescCallSite onAssemblyResolve (METHOD__ASSEMBLYLOADCONTEXT__ON_ASSEMBLY_RESOLVE);
3794-
3795- gc.str = StringObject::NewString (ssName);
3796- ARG_SLOT args[2 ] = {
3797- ObjToArgSlot (gc.AssemblyRef ),
3798- ObjToArgSlot (gc.str )
3799- };
3800-
3801- gc.AssemblyRef = (ASSEMBLYREF) onAssemblyResolve.Call_RetOBJECTREF (args);
3775+ UnmanagedCallersOnlyCaller onAssemblyResolve (METHOD__ASSEMBLYLOADCONTEXT__ON_ASSEMBLY_RESOLVE);
3776+ onAssemblyResolve.InvokeThrowing (&gc.AssemblyRef , ssName.GetUnicode (), &gc.ResultRef );
38023777
3803- if (gc.AssemblyRef != NULL )
3778+ if (gc.ResultRef != NULL )
38043779 {
3805- _ASSERTE (CoreLibBinder::IsClass (gc.AssemblyRef ->GetMethodTable (), CLASS__ASSEMBLY));
3780+ _ASSERTE (CoreLibBinder::IsClass (gc.ResultRef ->GetMethodTable (), CLASS__ASSEMBLY));
38063781
3807- pAssembly = gc.AssemblyRef ->GetAssembly ();
3782+ pAssembly = gc.ResultRef ->GetAssembly ();
38083783 if (pAssembly->IsCollectible ())
38093784 {
38103785 COMPlusThrow (kNotSupportedException , W (" NotSupported_CollectibleAssemblyResolve" ));
@@ -4136,18 +4111,8 @@ HRESULT RuntimeInvokeHostAssemblyResolver(INT_PTR pAssemblyLoadContextToBindWith
41364111 // This is not invoked for TPA Binder since it always returns NULL.
41374112 tracer.GoToStage (BinderTracing::ResolutionAttemptedOperation::Stage::AssemblyLoadContextLoad);
41384113
4139- // Finally, setup arguments for invocation
4140- MethodDescCallSite methLoadAssembly (METHOD__ASSEMBLYLOADCONTEXT__RESOLVE);
4141-
4142- // Setup the arguments for the call
4143- ARG_SLOT args[2 ] =
4144- {
4145- PtrToArgSlot (pAssemblyLoadContextToBindWithin), // IntPtr for managed assembly load context instance
4146- ObjToArgSlot (_gcRefs.oRefAssemblyName ), // AssemblyName instance
4147- };
4148-
4149- // Make the call
4150- _gcRefs.oRefLoadedAssembly = (ASSEMBLYREF) methLoadAssembly.Call_RetOBJECTREF (args);
4114+ UnmanagedCallersOnlyCaller methLoadAssembly (METHOD__ASSEMBLYLOADCONTEXT__RESOLVE);
4115+ methLoadAssembly.InvokeThrowing (pAssemblyLoadContextToBindWithin, &_gcRefs.oRefAssemblyName , &_gcRefs.oRefLoadedAssembly );
41514116 if (_gcRefs.oRefLoadedAssembly != NULL )
41524117 {
41534118 fResolvedAssembly = true ;
@@ -4184,17 +4149,8 @@ HRESULT RuntimeInvokeHostAssemblyResolver(INT_PTR pAssemblyLoadContextToBindWith
41844149 // Finally, setup arguments for invocation
41854150 tracer.GoToStage (BinderTracing::ResolutionAttemptedOperation::Stage::ResolveSatelliteAssembly);
41864151
4187- MethodDescCallSite methResolveSateliteAssembly (METHOD__ASSEMBLYLOADCONTEXT__RESOLVESATELLITEASSEMBLY);
4188-
4189- // Setup the arguments for the call
4190- ARG_SLOT args[2 ] =
4191- {
4192- PtrToArgSlot (pAssemblyLoadContextToBindWithin), // IntPtr for managed assembly load context instance
4193- ObjToArgSlot (_gcRefs.oRefAssemblyName ), // AssemblyName instance
4194- };
4195-
4196- // Make the call
4197- _gcRefs.oRefLoadedAssembly = (ASSEMBLYREF) methResolveSateliteAssembly.Call_RetOBJECTREF (args);
4152+ UnmanagedCallersOnlyCaller methResolveSateliteAssembly (METHOD__ASSEMBLYLOADCONTEXT__RESOLVESATELLITEASSEMBLY);
4153+ methResolveSateliteAssembly.InvokeThrowing (pAssemblyLoadContextToBindWithin, &_gcRefs.oRefAssemblyName , &_gcRefs.oRefLoadedAssembly );
41984154 if (_gcRefs.oRefLoadedAssembly != NULL )
41994155 {
42004156 // Set the flag indicating we found the assembly
@@ -4213,17 +4169,8 @@ HRESULT RuntimeInvokeHostAssemblyResolver(INT_PTR pAssemblyLoadContextToBindWith
42134169 // Finally, setup arguments for invocation
42144170 tracer.GoToStage (BinderTracing::ResolutionAttemptedOperation::Stage::AssemblyLoadContextResolvingEvent);
42154171
4216- MethodDescCallSite methResolveUsingEvent (METHOD__ASSEMBLYLOADCONTEXT__RESOLVEUSINGEVENT);
4217-
4218- // Setup the arguments for the call
4219- ARG_SLOT args[2 ] =
4220- {
4221- PtrToArgSlot (pAssemblyLoadContextToBindWithin), // IntPtr for managed assembly load context instance
4222- ObjToArgSlot (_gcRefs.oRefAssemblyName ), // AssemblyName instance
4223- };
4224-
4225- // Make the call
4226- _gcRefs.oRefLoadedAssembly = (ASSEMBLYREF) methResolveUsingEvent.Call_RetOBJECTREF (args);
4172+ UnmanagedCallersOnlyCaller methResolveUsingEvent (METHOD__ASSEMBLYLOADCONTEXT__RESOLVEUSINGEVENT);
4173+ methResolveUsingEvent.InvokeThrowing (pAssemblyLoadContextToBindWithin, &_gcRefs.oRefAssemblyName , &_gcRefs.oRefLoadedAssembly );
42274174 if (_gcRefs.oRefLoadedAssembly != NULL )
42284175 {
42294176 // Set the flag indicating we found the assembly
0 commit comments