File tree 4 files changed +20
-16
lines changed
System.Private.CoreLib/src/System/Reflection
4 files changed +20
-16
lines changed Original file line number Diff line number Diff line change @@ -584,9 +584,17 @@ private CultureInfo GetLocale()
584
584
}
585
585
586
586
[ MethodImpl ( MethodImplOptions . InternalCall ) ]
587
- private static extern bool FCallIsDynamic ( RuntimeAssembly assembly ) ;
587
+ private static extern bool GetIsDynamic ( IntPtr assembly ) ;
588
588
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
+ }
590
598
591
599
[ LibraryImport ( RuntimeHelpers . QCall , EntryPoint = "AssemblyNative_GetSimpleName" ) ]
592
600
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
513
513
END_QCALL;
514
514
}
515
515
516
- FCIMPL1 (FC_BOOL_RET, AssemblyNative::IsDynamic, AssemblyBaseObject* pAssemblyUNSAFE )
516
+ FCIMPL1 (FC_BOOL_RET, AssemblyNative::GetIsDynamic, Assembly* pAssembly )
517
517
{
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 ;
524
524
525
- FC_RETURN_BOOL (refAssembly-> GetAssembly () ->GetPEAssembly ()->IsReflectionEmit ());
525
+ FC_RETURN_BOOL (pAssembly ->GetPEAssembly ()->IsReflectionEmit ());
526
526
}
527
527
FCIMPLEND
528
528
Original file line number Diff line number Diff line change @@ -19,10 +19,6 @@ class CustomAssemblyBinder;
19
19
20
20
class AssemblyNative
21
21
{
22
- friend class Assembly ;
23
- friend class BaseDomain ;
24
- friend class DomainAssembly ;
25
-
26
22
public:
27
23
28
24
static Assembly* LoadFromPEImage (AssemblyBinder* pBinder, PEImage *pImage, bool excludeAppPaths = false );
@@ -35,7 +31,7 @@ class AssemblyNative
35
31
//
36
32
37
33
static
38
- FCDECL1 (FC_BOOL_RET, IsDynamic, AssemblyBaseObject * pAssemblyUNSAFE );
34
+ FCDECL1 (FC_BOOL_RET, GetIsDynamic, Assembly* pAssembly );
39
35
};
40
36
41
37
extern " C" uint32_t QCALLTYPE AssemblyNative_GetAssemblyCount ();
Original file line number Diff line number Diff line change @@ -222,7 +222,7 @@ FCFuncStart(gCOMModuleHandleFuncs)
222
222
FCFuncEnd ()
223
223
224
224
FCFuncStart (gRuntimeAssemblyFuncs )
225
- FCFuncElement ("FCallIsDynamic " , AssemblyNative ::IsDynamic )
225
+ FCFuncElement ("GetIsDynamic " , AssemblyNative ::GetIsDynamic )
226
226
FCFuncElement ("GetManifestModule" , AssemblyHandle ::GetManifestModule )
227
227
FCFuncElement ("GetToken" , AssemblyHandle ::GetToken )
228
228
FCFuncEnd ()
You can’t perform that action at this time.
0 commit comments