File tree Expand file tree Collapse file tree 4 files changed +12
-11
lines changed
coreclr/System.Private.CoreLib/src/System/Reflection/Emit
System.Private.CoreLib/src/System/Reflection/Emit
System.Reflection.Emit/tests
System.Reflection/tests/CoreCLR Expand file tree Collapse file tree 4 files changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ public override FileStream[] GetFiles(bool getResourceModules)
104104 throw new NotSupportedException ( SR . NotSupported_DynamicAssembly ) ;
105105 }
106106
107- public override string Location => throw new NotSupportedException ( SR . NotSupported_DynamicAssembly ) ;
107+ public override string Location => string . Empty ;
108108
109109 [ RequiresAssemblyFiles ( ThrowingMessageInRAF ) ]
110110 public override string ? CodeBase => throw new NotSupportedException ( SR . NotSupported_DynamicAssembly ) ;
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ public sealed partial class AssemblyBuilder : Assembly
1010 {
1111 [ RequiresAssemblyFiles ( ThrowingMessageInRAF ) ]
1212 public override string ? CodeBase => throw new NotSupportedException ( SR . NotSupported_DynamicAssembly ) ;
13- public override string Location => throw new NotSupportedException ( SR . NotSupported_DynamicAssembly ) ;
13+ public override string Location => string . Empty ;
1414 public override MethodInfo ? EntryPoint => null ;
1515 public override bool IsDynamic => true ;
1616
Original file line number Diff line number Diff line change 33
44using System . Collections . Generic ;
55using System . Linq ;
6- using System . Runtime . InteropServices ;
76using Xunit ;
87
98namespace System . Reflection . Emit . Tests
@@ -424,7 +423,17 @@ void Invoke_Private_SameAssembly_ThrowsMethodAccessException()
424423 Assert . Throws < MethodAccessException > ( ( ) => d ( ) ) ;
425424 }
426425
426+ [ Fact ]
427+ public void DefineDynamicAssembly_AssemblyBuilderLocationIsEmpty_InternalAssemblyBuilderLocationIsEmpty ( )
428+ {
429+ AssemblyBuilder assembly = Helpers . DynamicAssembly ( nameof ( DefineDynamicAssembly_AssemblyBuilderLocationIsEmpty_InternalAssemblyBuilderLocationIsEmpty ) ) ;
430+ Assembly internalAssemblyBuilder = AppDomain . CurrentDomain . GetAssemblies ( )
431+ . FirstOrDefault ( a => a . FullName == assembly . FullName ) ;
427432
433+ Assert . Empty ( assembly . Location ) ;
434+ Assert . NotNull ( internalAssemblyBuilder ) ;
435+ Assert . Empty ( internalAssemblyBuilder . Location ) ;
436+ }
428437
429438 }
430439}
Original file line number Diff line number Diff line change 22// The .NET Foundation licenses this file to you under the MIT license.
33
44using System . IO ;
5- using System . Reflection . Emit ;
65using System . Runtime . Loader ;
76using Xunit ;
87
@@ -30,13 +29,6 @@ public void LoadFromStream_Location_IsEmpty()
3029 Assert . Empty ( assembly . Location ) ;
3130 }
3231
33- [ Fact ]
34- public void DynamicAssembly_Location_ThrowsNotSupportedException ( )
35- {
36- AssemblyBuilder builder = AssemblyBuilder . DefineDynamicAssembly ( new AssemblyName ( "dynamic" ) , AssemblyBuilderAccess . Run ) ;
37- Assert . Throws < NotSupportedException > ( ( ) => builder . Location ) ;
38- }
39-
4032 [ Fact ]
4133 public void EntryPoint ( )
4234 {
You can’t perform that action at this time.
0 commit comments