@@ -411,100 +411,100 @@ private static void VerifyAssemblyBuilder(AssemblyBuilder assembly, AssemblyName
411411 Assert . Empty ( assembly . GetTypes ( ) ) ;
412412 }
413413
414- private static void SamplePrivateMethod ( )
415- {
416- }
414+ private static void SamplePrivateMethod ( )
415+ {
416+ }
417417
418- internal static void SampleInternalMethod ( )
419- {
420- }
418+ internal static void SampleInternalMethod ( )
419+ {
420+ }
421421
422- [ ConditionalFact ( typeof ( PlatformDetection ) , nameof ( PlatformDetection . IsReflectionEmitSupported ) ) ]
423- void Invoke_Private_CrossAssembly_ThrowsMethodAccessException ( )
424- {
425- TypeBuilder tb = Helpers . DynamicType ( TypeAttributes . Public ) ;
426- var mb = tb . DefineMethod ( "MyMethod" , MethodAttributes . Public | MethodAttributes . Static , typeof ( void ) , new Type [ ] { } ) ;
422+ [ ConditionalFact ( typeof ( PlatformDetection ) , nameof ( PlatformDetection . IsReflectionEmitSupported ) ) ]
423+ void Invoke_Private_CrossAssembly_ThrowsMethodAccessException ( )
424+ {
425+ TypeBuilder tb = Helpers . DynamicType ( TypeAttributes . Public ) ;
426+ var mb = tb . DefineMethod ( "MyMethod" , MethodAttributes . Public | MethodAttributes . Static , typeof ( void ) , new Type [ ] { } ) ;
427427
428- var ilg = mb . GetILGenerator ( ) ;
428+ var ilg = mb . GetILGenerator ( ) ;
429429
430- var callee = typeof ( AssemblyTests ) . GetMethod ( "SamplePrivateMethod" , BindingFlags . Static | BindingFlags . NonPublic ) ;
430+ var callee = typeof ( AssemblyTests ) . GetMethod ( "SamplePrivateMethod" , BindingFlags . Static | BindingFlags . NonPublic ) ;
431431
432- ilg . Emit ( OpCodes . Call , callee ) ;
433- ilg . Emit ( OpCodes . Ret ) ;
432+ ilg . Emit ( OpCodes . Call , callee ) ;
433+ ilg . Emit ( OpCodes . Ret ) ;
434434
435- var ty = tb . CreateType ( ) ;
435+ var ty = tb . CreateType ( ) ;
436436
437- var mi = ty . GetMethod ( "MyMethod" , BindingFlags . Static | BindingFlags . Public ) ;
437+ var mi = ty . GetMethod ( "MyMethod" , BindingFlags . Static | BindingFlags . Public ) ;
438438
439- var d = ( Action ) mi . CreateDelegate ( typeof ( Action ) ) ;
439+ var d = ( Action ) mi . CreateDelegate ( typeof ( Action ) ) ;
440440
441- Assert . Throws < MethodAccessException > ( ( ) => d ( ) ) ;
442- }
441+ Assert . Throws < MethodAccessException > ( ( ) => d ( ) ) ;
442+ }
443443
444- [ ConditionalFact ( typeof ( PlatformDetection ) , nameof ( PlatformDetection . IsReflectionEmitSupported ) ) ]
445- void Invoke_Internal_CrossAssembly_ThrowsMethodAccessException ( )
446- {
447- TypeBuilder tb = Helpers . DynamicType ( TypeAttributes . Public ) ;
448- var mb = tb . DefineMethod ( "MyMethod" , MethodAttributes . Public | MethodAttributes . Static , typeof ( void ) , new Type [ ] { } ) ;
444+ [ ConditionalFact ( typeof ( PlatformDetection ) , nameof ( PlatformDetection . IsReflectionEmitSupported ) ) ]
445+ void Invoke_Internal_CrossAssembly_ThrowsMethodAccessException ( )
446+ {
447+ TypeBuilder tb = Helpers . DynamicType ( TypeAttributes . Public ) ;
448+ var mb = tb . DefineMethod ( "MyMethod" , MethodAttributes . Public | MethodAttributes . Static , typeof ( void ) , new Type [ ] { } ) ;
449449
450- var ilg = mb . GetILGenerator ( ) ;
450+ var ilg = mb . GetILGenerator ( ) ;
451451
452- var callee = typeof ( AssemblyTests ) . GetMethod ( "SampleInternalMethod" , BindingFlags . Static | BindingFlags . NonPublic ) ;
452+ var callee = typeof ( AssemblyTests ) . GetMethod ( "SampleInternalMethod" , BindingFlags . Static | BindingFlags . NonPublic ) ;
453453
454- ilg . Emit ( OpCodes . Call , callee ) ;
455- ilg . Emit ( OpCodes . Ret ) ;
454+ ilg . Emit ( OpCodes . Call , callee ) ;
455+ ilg . Emit ( OpCodes . Ret ) ;
456456
457- var ty = tb . CreateType ( ) ;
457+ var ty = tb . CreateType ( ) ;
458458
459- var mi = ty . GetMethod ( "MyMethod" , BindingFlags . Static | BindingFlags . Public ) ;
459+ var mi = ty . GetMethod ( "MyMethod" , BindingFlags . Static | BindingFlags . Public ) ;
460460
461- var d = ( Action ) mi . CreateDelegate ( typeof ( Action ) ) ;
461+ var d = ( Action ) mi . CreateDelegate ( typeof ( Action ) ) ;
462462
463- Assert . Throws < MethodAccessException > ( ( ) => d ( ) ) ;
464- }
463+ Assert . Throws < MethodAccessException > ( ( ) => d ( ) ) ;
464+ }
465465
466- [ ConditionalFact ( typeof ( PlatformDetection ) , nameof ( PlatformDetection . IsReflectionEmitSupported ) ) ]
467- void Invoke_Private_SameAssembly_ThrowsMethodAccessException ( )
468- {
469- ModuleBuilder modb = Helpers . DynamicModule ( ) ;
466+ [ ConditionalFact ( typeof ( PlatformDetection ) , nameof ( PlatformDetection . IsReflectionEmitSupported ) ) ]
467+ void Invoke_Private_SameAssembly_ThrowsMethodAccessException ( )
468+ {
469+ ModuleBuilder modb = Helpers . DynamicModule ( ) ;
470470
471- string calleeName = "PrivateMethod" ;
471+ string calleeName = "PrivateMethod" ;
472472
473- TypeBuilder tbCalled = modb . DefineType ( "CalledClass" , TypeAttributes . Public ) ;
474- var mbCalled = tbCalled . DefineMethod ( calleeName , MethodAttributes . Private | MethodAttributes . Static ) ;
475- mbCalled . GetILGenerator ( ) . Emit ( OpCodes . Ret ) ;
473+ TypeBuilder tbCalled = modb . DefineType ( "CalledClass" , TypeAttributes . Public ) ;
474+ var mbCalled = tbCalled . DefineMethod ( calleeName , MethodAttributes . Private | MethodAttributes . Static ) ;
475+ mbCalled . GetILGenerator ( ) . Emit ( OpCodes . Ret ) ;
476476
477- var tyCalled = tbCalled . CreateType ( ) ;
478- var callee = tyCalled . GetMethod ( calleeName , BindingFlags . NonPublic | BindingFlags . Static ) ;
477+ var tyCalled = tbCalled . CreateType ( ) ;
478+ var callee = tyCalled . GetMethod ( calleeName , BindingFlags . NonPublic | BindingFlags . Static ) ;
479479
480- TypeBuilder tb = modb . DefineType ( "CallerClass" , TypeAttributes . Public ) ;
481- var mb = tb . DefineMethod ( "MyMethod" , MethodAttributes . Public | MethodAttributes . Static , typeof ( void ) , new Type [ ] { } ) ;
480+ TypeBuilder tb = modb . DefineType ( "CallerClass" , TypeAttributes . Public ) ;
481+ var mb = tb . DefineMethod ( "MyMethod" , MethodAttributes . Public | MethodAttributes . Static , typeof ( void ) , new Type [ ] { } ) ;
482482
483- var ilg = mb . GetILGenerator ( ) ;
483+ var ilg = mb . GetILGenerator ( ) ;
484484
485- ilg . Emit ( OpCodes . Call , callee ) ;
486- ilg . Emit ( OpCodes . Ret ) ;
485+ ilg . Emit ( OpCodes . Call , callee ) ;
486+ ilg . Emit ( OpCodes . Ret ) ;
487487
488- var ty = tb . CreateType ( ) ;
488+ var ty = tb . CreateType ( ) ;
489489
490- var mi = ty . GetMethod ( "MyMethod" , BindingFlags . Static | BindingFlags . Public ) ;
490+ var mi = ty . GetMethod ( "MyMethod" , BindingFlags . Static | BindingFlags . Public ) ;
491491
492- var d = ( Action ) mi . CreateDelegate ( typeof ( Action ) ) ;
492+ var d = ( Action ) mi . CreateDelegate ( typeof ( Action ) ) ;
493493
494- Assert . Throws < MethodAccessException > ( ( ) => d ( ) ) ;
495- }
494+ Assert . Throws < MethodAccessException > ( ( ) => d ( ) ) ;
495+ }
496496
497- [ Fact ]
498- public void DefineDynamicAssembly_AssemblyBuilderLocationIsEmpty_InternalAssemblyBuilderLocationIsEmpty ( )
499- {
500- AssemblyBuilder assembly = Helpers . DynamicAssembly ( nameof ( DefineDynamicAssembly_AssemblyBuilderLocationIsEmpty_InternalAssemblyBuilderLocationIsEmpty ) ) ;
501- Assembly internalAssemblyBuilder = AppDomain . CurrentDomain . GetAssemblies ( )
502- . FirstOrDefault ( a => a . FullName == assembly . FullName ) ;
497+ [ Fact ]
498+ public void DefineDynamicAssembly_AssemblyBuilderLocationIsEmpty_InternalAssemblyBuilderLocationIsEmpty ( )
499+ {
500+ AssemblyBuilder assembly = Helpers . DynamicAssembly ( nameof ( DefineDynamicAssembly_AssemblyBuilderLocationIsEmpty_InternalAssemblyBuilderLocationIsEmpty ) ) ;
501+ Assembly internalAssemblyBuilder = AppDomain . CurrentDomain . GetAssemblies ( )
502+ . FirstOrDefault ( a => a . FullName == assembly . FullName ) ;
503503
504- Assert . Empty ( assembly . Location ) ;
505- Assert . NotNull ( internalAssemblyBuilder ) ;
506- Assert . Empty ( internalAssemblyBuilder . Location ) ;
507- }
504+ Assert . Empty ( assembly . Location ) ;
505+ Assert . NotNull ( internalAssemblyBuilder ) ;
506+ Assert . Empty ( internalAssemblyBuilder . Location ) ;
507+ }
508508
509509 [ ConditionalFact ( typeof ( RemoteExecutor ) , nameof ( RemoteExecutor . IsSupported ) ) ]
510510 public static void ThrowsWhenDynamicCodeNotSupported ( )
0 commit comments