@@ -37,13 +37,19 @@ public static string[] GetUsingNamespacesFromTLS()
3737
3838 if ( GetExecutionContextFromTLSMethod is null ) return null ;
3939
40- PropertyInfo ? getEngineSessionState = ExecutionContextType ? . GetProperty ( "EngineSessionState" , flags ) ;
40+ MethodInfo ? getEngineSessionState = ExecutionContextType
41+ ? . GetProperty ( "EngineSessionState" , flags )
42+ ? . GetGetMethod ( nonPublic : true ) ;
4143 if ( getEngineSessionState is null ) return null ;
4244
43- PropertyInfo ? currentScope = getEngineSessionState . GetReturnType ( ) ? . GetProperty ( "CurrentScope" , flags ) ;
45+ MethodInfo ? currentScope = getEngineSessionState ? . ReturnType
46+ ? . GetProperty ( "CurrentScope" , flags )
47+ ? . GetGetMethod ( nonPublic : true ) ;
4448 if ( currentScope is null ) return null ;
4549
46- PropertyInfo ? typeRes = currentScope . GetReturnType ( ) ? . GetProperty ( "TypeResolutionState" , flags ) ;
50+ MethodInfo ? typeRes = currentScope ? . ReturnType
51+ ? . GetProperty ( "TypeResolutionState" , flags )
52+ ? . GetGetMethod ( nonPublic : true ) ;
4753 if ( typeRes is null ) return null ;
4854
4955 FieldInfo ? namespaces = typeRes . GetReturnType ( ) ? . GetField ( "namespaces" , flags ) ;
@@ -56,9 +62,9 @@ public static string[] GetUsingNamespacesFromTLS()
5662 Expression . Call (
5763 Expression . Call (
5864 Expression . Call ( GetExecutionContextFromTLSMethod ) ,
59- getEngineSessionState . GetGetMethod ( nonPublic : true ) ) ,
60- currentScope . GetGetMethod ( nonPublic : true ) ) ,
61- typeRes . GetGetMethod ( nonPublic : true ) ) ,
65+ getEngineSessionState ! ) ,
66+ currentScope ! ) ,
67+ typeRes ) ,
6268 namespaces ) ,
6369 "GetUsingNamespacesDynamically" ,
6470 [ ] )
0 commit comments