File tree Expand file tree Collapse file tree 4 files changed +20
-16
lines changed
System.Private.CoreLib/src/System/Reflection Expand file tree Collapse file tree 4 files changed +20
-16
lines changed Original file line number Diff line number Diff line change @@ -584,9 +584,17 @@ private CultureInfo GetLocale()
584584 }
585585
586586 [ MethodImpl ( MethodImplOptions . InternalCall ) ]
587- private static extern bool FCallIsDynamic ( RuntimeAssembly assembly ) ;
587+ private static extern bool GetIsDynamic ( IntPtr assembly ) ;
588588
589- public override bool IsDynamic => FCallIsDynamic ( this ) ;
589+ public override bool IsDynamic
590+ {
591+ get
592+ {
593+ bool isDynamic = GetIsDynamic ( GetUnderlyingNativeHandle ( ) ) ;
594+ GC . KeepAlive ( this ) ; // We directly pass the native handle above - make sure this object stays alive for the call
595+ return isDynamic ;
596+ }
597+ }
590598
591599 [ LibraryImport ( RuntimeHelpers . QCall , EntryPoint = "AssemblyNative_GetSimpleName" ) ]
592600 private static partial void GetSimpleName ( QCallAssembly assembly , StringHandleOnStack retSimpleName ) ;
Original file line number Diff line number Diff line change @@ -513,16 +513,16 @@ extern "C" void QCALLTYPE AssemblyNative_GetForwardedType(QCall::AssemblyHandle
513513 END_QCALL;
514514}
515515
516- FCIMPL1 (FC_BOOL_RET, AssemblyNative::IsDynamic, AssemblyBaseObject* pAssemblyUNSAFE )
516+ FCIMPL1 (FC_BOOL_RET, AssemblyNative::GetIsDynamic, Assembly* pAssembly )
517517{
518- FCALL_CONTRACT;
519-
520- ASSEMBLYREF refAssembly = (ASSEMBLYREF) ObjectToOBJECTREF (pAssemblyUNSAFE) ;
521-
522- if (refAssembly == NULL )
523- FCThrowRes ( kArgumentNullException , W ( " Arg_InvalidHandle " )) ;
518+ CONTRACTL
519+ {
520+ FCALL_CHECK ;
521+ PRECONDITION ( CheckPointer (pAssembly));
522+ }
523+ CONTRACTL_END ;
524524
525- FC_RETURN_BOOL (refAssembly-> GetAssembly () ->GetPEAssembly ()->IsReflectionEmit ());
525+ FC_RETURN_BOOL (pAssembly ->GetPEAssembly ()->IsReflectionEmit ());
526526}
527527FCIMPLEND
528528
Original file line number Diff line number Diff line change @@ -19,10 +19,6 @@ class CustomAssemblyBinder;
1919
2020class AssemblyNative
2121{
22- friend class Assembly ;
23- friend class BaseDomain ;
24- friend class DomainAssembly ;
25-
2622public:
2723
2824 static Assembly* LoadFromPEImage (AssemblyBinder* pBinder, PEImage *pImage, bool excludeAppPaths = false );
@@ -35,7 +31,7 @@ class AssemblyNative
3531 //
3632
3733 static
38- FCDECL1 (FC_BOOL_RET, IsDynamic, AssemblyBaseObject * pAssemblyUNSAFE );
34+ FCDECL1 (FC_BOOL_RET, GetIsDynamic, Assembly* pAssembly );
3935};
4036
4137extern " C" uint32_t QCALLTYPE AssemblyNative_GetAssemblyCount ();
Original file line number Diff line number Diff line change @@ -222,7 +222,7 @@ FCFuncStart(gCOMModuleHandleFuncs)
222222FCFuncEnd ()
223223
224224FCFuncStart (gRuntimeAssemblyFuncs )
225- FCFuncElement ("FCallIsDynamic " , AssemblyNative ::IsDynamic )
225+ FCFuncElement ("GetIsDynamic " , AssemblyNative ::GetIsDynamic )
226226 FCFuncElement ("GetManifestModule" , AssemblyHandle ::GetManifestModule )
227227 FCFuncElement ("GetToken" , AssemblyHandle ::GetToken )
228228FCFuncEnd ()
You can’t perform that action at this time.
0 commit comments