From 38aa68de397a798323f4bdade81b711a1e6cfe5e Mon Sep 17 00:00:00 2001 From: Neal Gafter Date: Fri, 13 Mar 2015 15:56:30 -0700 Subject: [PATCH] Add the module name to generated PrivateImplementationDetails class so that there will be no conflict if they are used as netmodules Fixes #1228 --- .../Portable/Emitter/Model/PEModuleBuilder.cs | 2 +- .../Test/Emit/CodeGen/CodeGenForEachTests.cs | 4 +- .../CSharp/Test/Emit/CodeGen/CodeGenTests.cs | 54 +++++++++---------- .../CSharp/Test/Emit/CodeGen/IndexerTests.cs | 24 ++++----- .../CSharp/Test/Emit/CodeGen/SwitchTests.cs | 18 +++---- .../Test/Emit/Emit/CompilationEmitTests.cs | 46 ++++++++++++++++ .../EditAndContinue/EditAndContinueTests.cs | 10 ++-- .../CSharp/Test/Emit/PDB/PDBTests.cs | 4 +- .../WinRT/CodeGen/WinRTCollectionTests.cs | 2 +- .../CodeGen/PrivateImplementationDetails.cs | 29 +++++----- .../Portable/Emit/CommonPEModuleBuilder.cs | 14 +++-- .../Portable/Emit/PEModuleBuilder.vb | 2 +- .../Test/Emit/CodeGen/CodeGenForeach.vb | 12 ++--- .../CodeGen/CodeGenMultiDimensionalArray.vb | 8 +-- .../Test/Emit/CodeGen/CodeGenSelectCase.vb | 10 ++-- .../Test/Emit/CodeGen/CodeGenTests.vb | 26 ++++----- .../Test/Emit/CodeGen/WinRTCollectionTests.vb | 3 +- .../Test/Emit/Emit/EditAndContinueTests.vb | 10 ++-- .../ExpressionCompilerTests.cs | 2 +- 19 files changed, 162 insertions(+), 118 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Emitter/Model/PEModuleBuilder.cs b/src/Compilers/CSharp/Portable/Emitter/Model/PEModuleBuilder.cs index e5706e8fbd00d..c0e9b365493ed 100644 --- a/src/Compilers/CSharp/Portable/Emitter/Model/PEModuleBuilder.cs +++ b/src/Compilers/CSharp/Portable/Emitter/Model/PEModuleBuilder.cs @@ -16,7 +16,7 @@ namespace Microsoft.CodeAnalysis.CSharp.Emit { - internal abstract class PEModuleBuilder : PEModuleBuilder + internal abstract class PEModuleBuilder : PEModuleBuilder { // TODO: Need to estimate amount of elements for this map and pass that value to the constructor. protected readonly ConcurrentDictionary AssemblyOrModuleSymbolToModuleRefMap = new ConcurrentDictionary(); diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenForEachTests.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenForEachTests.cs index bdd1a7142267d..bbb723932afb3 100644 --- a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenForEachTests.cs +++ b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenForEachTests.cs @@ -98,7 +98,7 @@ static void Main() } } }"; - var compilation = CompileAndVerify(source, expectedOutput: @" + var compilation = CompileAndVerify(source, options: TestOptions.ReleaseExe.WithModuleName("MODULE"), expectedOutput: @" 1.2 2.3 3.4 @@ -121,7 +121,7 @@ .locals init (double[,] V_0, IL_0001: ldc.i4.4 IL_0002: newobj ""double[*,*]..ctor"" IL_0007: dup - IL_0008: ldtoken "".__StaticArrayInitTypeSize=64 .$$method0x6000001-E19C080DB8DAB85AF7CA3EF40FFB01B0778F9D25"" + IL_0008: ldtoken "".__StaticArrayInitTypeSize=64 .E19C080DB8DAB85AF7CA3EF40FFB01B0778F9D25"" IL_000d: call ""void System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)"" IL_0012: stloc.0 IL_0013: ldloc.0 diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenTests.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenTests.cs index e91517c60e22c..329d026f371e3 100644 --- a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenTests.cs +++ b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenTests.cs @@ -3231,7 +3231,7 @@ public static void Main() } } "; - var compilation = CompileAndVerify(source, expectedOutput: "222333"); + var compilation = CompileAndVerify(source, options: TestOptions.ReleaseExe.WithModuleName("MODULE"), expectedOutput: "222333"); compilation.VerifyIL("D.Main", @"{ @@ -3241,7 +3241,7 @@ .locals init (int[] V_0) //arr IL_0000: ldc.i4.4 IL_0001: newarr ""int"" IL_0006: dup - IL_0007: ldtoken "".__StaticArrayInitTypeSize=16 .$$method0x6000001-42F1B77334EDFA917032CCF8353020C73F8C62E1"" + IL_0007: ldtoken "".__StaticArrayInitTypeSize=16 .42F1B77334EDFA917032CCF8353020C73F8C62E1"" IL_000c: call ""void System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)"" IL_0011: stloc.0 IL_0012: ldloc.0 @@ -3560,7 +3560,7 @@ static void Main() "); #region IL - // Can NOT compare IL because the Guid is different every time - {a6c2d596-042b-4294-99ab-d34a2758ec15} + // Can NOT compare IL because the Guid is different every time - {a6c2d596-042b-4294-99ab-d34a2758ec15} #if false compilation.VerifyIL("MyArray.Main", @"{ @@ -3594,7 +3594,7 @@ .locals init (sbyte[] V_0, //a1 IL_0028: ldc.i4.3 IL_0029: newarr ""byte"" IL_002e: dup - IL_002f: ldtoken ""{a6c2d596-042b-4294-99ab-d34a2758ec15}.__StaticArrayInitTypeSize=3 {a6c2d596-042b-4294-99ab-d34a2758ec15}.$$method0x6000001-0"" + IL_002f: ldtoken ""{a6c2d596-042b-4294-99ab-d34a2758ec15}.__StaticArrayInitTypeSize=3 {a6c2d596-042b-4294-99ab-d34a2758ec15}.0"" IL_0034: call ""void System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)"" IL_0039: ldc.i4.0 IL_003a: ldelem.u1 @@ -3620,7 +3620,7 @@ .locals init (sbyte[] V_0, //a1 IL_005f: ldc.i4.3 IL_0060: newarr ""short"" IL_0065: dup - IL_0066: ldtoken ""{a6c2d596-042b-4294-99ab-d34a2758ec15}.__StaticArrayInitTypeSize=6 {a6c2d596-042b-4294-99ab-d34a2758ec15}.$$method0x6000001-1"" + IL_0066: ldtoken ""{a6c2d596-042b-4294-99ab-d34a2758ec15}.__StaticArrayInitTypeSize=6 {a6c2d596-042b-4294-99ab-d34a2758ec15}.1"" IL_006b: call ""void System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)"" IL_0070: stelem.ref IL_0071: ldc.i4.1 @@ -6383,7 +6383,7 @@ public static void Main() System.Console.WriteLine(d[4]); } }"; - var compilation = CompileAndVerify(source, expectedOutput: @" + var compilation = CompileAndVerify(source, options: TestOptions.ReleaseExe.WithModuleName("MODULE"), expectedOutput: @" 3 -5 True @@ -6406,7 +6406,7 @@ .maxstack 3 IL_0000: ldc.i4.5 IL_0001: newarr ""int"" IL_0006: dup - IL_0007: ldtoken "".__StaticArrayInitTypeSize=20 .$$method0x6000001-56C14CB445C628421AC674599E302B0879FB496F"" + IL_0007: ldtoken "".__StaticArrayInitTypeSize=20 .56C14CB445C628421AC674599E302B0879FB496F"" IL_000c: call ""void System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)"" IL_0011: dup IL_0012: ldc.i4.2 @@ -6418,7 +6418,7 @@ .maxstack 3 IL_0020: ldc.i4.5 IL_0021: newarr ""bool"" IL_0026: dup - IL_0027: ldtoken "".__StaticArrayInitTypeSize=5 .$$method0x6000001-4E724558F6B816715597A51663AD8F05247E2C4A"" + IL_0027: ldtoken "".__StaticArrayInitTypeSize=5 .4E724558F6B816715597A51663AD8F05247E2C4A"" IL_002c: call ""void System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)"" IL_0031: dup IL_0032: ldc.i4.2 @@ -6430,7 +6430,7 @@ .maxstack 3 IL_0040: ldc.i4.5 IL_0041: newarr ""byte"" IL_0046: dup - IL_0047: ldtoken "".__StaticArrayInitTypeSize=5 .$$method0x6000001-9755240DD0C4C1AD226DEBD40C6D2EBD408250CB"" + IL_0047: ldtoken "".__StaticArrayInitTypeSize=5 .9755240DD0C4C1AD226DEBD40C6D2EBD408250CB"" IL_004c: call ""void System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)"" IL_0051: dup IL_0052: ldc.i4.2 @@ -6442,7 +6442,7 @@ .maxstack 3 IL_0060: ldc.i4.5 IL_0061: newarr ""char"" IL_0066: dup - IL_0067: ldtoken "".__StaticArrayInitTypeSize=10 .$$method0x6000001-E313A2813013780396D58750DC5D62221C86F42F"" + IL_0067: ldtoken "".__StaticArrayInitTypeSize=10 .E313A2813013780396D58750DC5D62221C86F42F"" IL_006c: call ""void System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)"" IL_0071: dup IL_0072: ldc.i4.2 @@ -6454,7 +6454,7 @@ .maxstack 3 IL_0080: ldc.i4.5 IL_0081: newarr ""float"" IL_0086: dup - IL_0087: ldtoken "".__StaticArrayInitTypeSize=20 .$$method0x6000001-2F3DD953DBFB23217E7CE0E76630EBD31267E237"" + IL_0087: ldtoken "".__StaticArrayInitTypeSize=20 .2F3DD953DBFB23217E7CE0E76630EBD31267E237"" IL_008c: call ""void System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)"" IL_0091: dup IL_0092: ldc.i4.2 @@ -6466,7 +6466,7 @@ .maxstack 3 IL_00a0: ldc.i4.5 IL_00a1: newarr ""double"" IL_00a6: dup - IL_00a7: ldtoken "".__StaticArrayInitTypeSize=40 .$$method0x6000001-11F3436B917FFBA0FAB0FAD5563AF18FA24AC16A"" + IL_00a7: ldtoken "".__StaticArrayInitTypeSize=40 .11F3436B917FFBA0FAB0FAD5563AF18FA24AC16A"" IL_00ac: call ""void System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)"" IL_00b1: dup IL_00b2: ldc.i4.2 @@ -6499,8 +6499,8 @@ public static void Main() } } "; - var compilation = CompileAndVerify(source, expectedOutput: @"3-5"); - //string pid = "" + compilation.Compilation.SourceModule.Pers + var compilation = CompileAndVerify(source, options: TestOptions.ReleaseExe.WithModuleName("MODULE"), expectedOutput: @"3-5"); + //string pid = "" + compilation.Compilation.SourceModule.Pers compilation.VerifyIL("D.Main", @"{ // Code size 73 (0x49) @@ -6509,7 +6509,7 @@ .locals init (int[] V_0) //x IL_0000: ldc.i4.5 IL_0001: newarr ""int"" IL_0006: dup - IL_0007: ldtoken "".__StaticArrayInitTypeSize=20 .$$method0x6000001-FF942E5F620FC460CF9424D564C73AD8A99C74EE"" + IL_0007: ldtoken "".__StaticArrayInitTypeSize=20 .FF942E5F620FC460CF9424D564C73AD8A99C74EE"" IL_000c: call ""void System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)"" IL_0011: dup IL_0012: ldc.i4.2 @@ -6524,7 +6524,7 @@ .locals init (int[] V_0) //x IL_0027: ldc.i4.5 IL_0028: newarr ""int"" IL_002d: dup - IL_002e: ldtoken "".__StaticArrayInitTypeSize=20 .$$method0x6000001-89E37886EEEDC70AEF61138E037CC60EFC35535F"" + IL_002e: ldtoken "".__StaticArrayInitTypeSize=20 .89E37886EEEDC70AEF61138E037CC60EFC35535F"" IL_0033: call ""void System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)"" IL_0038: dup IL_0039: ldc.i4.4 @@ -6561,8 +6561,8 @@ public static void Main() } } "; - var compilation = CompileAndVerify(source, expectedOutput: @"30"); - //string pid = "" + compilation.Compilation.SourceModule.Pers + var compilation = CompileAndVerify(source, options: TestOptions.ReleaseExe.WithModuleName("MODULE"), expectedOutput: @"30"); + //string pid = "" + compilation.Compilation.SourceModule.Pers compilation.VerifyIL("D.Main", @"{ // Code size 82 (0x52) @@ -6592,7 +6592,7 @@ .locals init (int[] V_0) //x IL_002e: ldc.i4.s 15 IL_0030: newarr ""int"" IL_0035: dup - IL_0036: ldtoken "".__StaticArrayInitTypeSize=60 .$$method0x6000001-49608711F905702F9F227AA782F8B408777D5DF9"" + IL_0036: ldtoken "".__StaticArrayInitTypeSize=60 .49608711F905702F9F227AA782F8B408777D5DF9"" IL_003b: call ""void System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)"" IL_0040: dup IL_0041: ldc.i4.s 12 @@ -6716,7 +6716,7 @@ public static void Main() DBNull "; - var compilation = CreateCompilationWithMscorlib45(source: source, options: TestOptions.ReleaseExe); + var compilation = CreateCompilationWithMscorlib45(source: source, options: TestOptions.ReleaseExe.WithModuleName("MODULE")); var verifier = CompileAndVerify(compilation, expectedOutput: expectedOutput); //NOTE: @@ -6728,7 +6728,7 @@ .maxstack 3 IL_0000: ldc.i4.5 IL_0001: newarr ""System.TypeCode"" IL_0006: dup - IL_0007: ldtoken "".__StaticArrayInitTypeSize=20 .$$method0x6000001-3191FF614021ADF3122AC274EA5B6097C21BEB81"" + IL_0007: ldtoken "".__StaticArrayInitTypeSize=20 .3191FF614021ADF3122AC274EA5B6097C21BEB81"" IL_000c: call ""void System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)"" IL_0011: dup IL_0012: ldc.i4.1 @@ -7240,7 +7240,7 @@ static void Main() } } "; - var compilation = CompileAndVerify(source, expectedOutput: @" + var compilation = CompileAndVerify(source, options: TestOptions.ReleaseExe.WithModuleName("MODULE"), expectedOutput: @" F1=3, F2=33 444 127 @@ -7301,7 +7301,7 @@ .locals init (Program.C V_0, //obj IL_0085: ldc.i4.4 IL_0086: newarr ""ushort"" IL_008b: dup - IL_008c: ldtoken ""long .$$method0x6000001-E9E8A66A117598333ABACF5B65971C2366E19B6C"" + IL_008c: ldtoken ""long .E9E8A66A117598333ABACF5B65971C2366E19B6C"" IL_0091: call ""void System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)"" IL_0096: callvirt ""uint Program.C.Foo(out short, params ushort[])"" IL_009b: call ""void System.Console.WriteLine(uint)"" @@ -7523,7 +7523,7 @@ public static void Main() } "; - var compilation = CompileAndVerify(source, options: TestOptions.DebugExe); + var compilation = CompileAndVerify(source, options: TestOptions.DebugExe.WithModuleName("MODULE")); compilation.VerifyIL("A.Main", @"{ @@ -7534,7 +7534,7 @@ .locals init (int[] V_0) //arr IL_0001: ldc.i4.5 IL_0002: newarr ""int"" IL_0007: dup - IL_0008: ldtoken "".__StaticArrayInitTypeSize=20 .$$method0x6000001-1036C5F8EF306104BD582D73E555F4DAE8EECB24"" + IL_0008: ldtoken "".__StaticArrayInitTypeSize=20 .1036C5F8EF306104BD582D73E555F4DAE8EECB24"" IL_000d: call ""void System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)"" IL_0012: stloc.0 IL_0013: ret @@ -13006,7 +13006,7 @@ static void Run() } } "; - var compilation = CompileAndVerify(source, expectedOutput: @"False + var compilation = CompileAndVerify(source, options: TestOptions.ReleaseExe.WithModuleName("MODULE"), expectedOutput: @"False True System.Exception: Exception of type 'System.Exception' was thrown. @@ -13047,7 +13047,7 @@ .maxstack 4 IL_0040: ldc.i4.4 IL_0041: newarr ""bool"" IL_0046: dup - IL_0047: ldtoken ""int .$$method0x6000001-35CCB1599F52363510686EF38B7DB5E7998DB108"" + IL_0047: ldtoken ""int .35CCB1599F52363510686EF38B7DB5E7998DB108"" IL_004c: call ""void System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)"" IL_0051: ldc.i4.2 IL_0052: ldelem.u1 diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/IndexerTests.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/IndexerTests.cs index a7fd81a752a76..b4fdd4ba49411 100644 --- a/src/Compilers/CSharp/Test/Emit/CodeGen/IndexerTests.cs +++ b/src/Compilers/CSharp/Test/Emit/CodeGen/IndexerTests.cs @@ -415,7 +415,7 @@ static void Main() } } "; - var compVerifier = CompileAndVerify(text); + var compVerifier = CompileAndVerify(text, options: TestOptions.ReleaseExe.WithModuleName("MODULE")); compVerifier.VerifyIL("Test.Main", @" { @@ -458,7 +458,7 @@ .locals init (C V_0) //c IL_003f: ldc.i4.3 IL_0040: newarr ""int"" IL_0045: dup - IL_0046: ldtoken "".__StaticArrayInitTypeSize=12 .$$method0x6000001-E429CCA3F703A39CC5954A6572FEC9086135B34E"" + IL_0046: ldtoken "".__StaticArrayInitTypeSize=12 .E429CCA3F703A39CC5954A6572FEC9086135B34E"" IL_004b: call ""void System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)"" IL_0050: callvirt ""int C.this[params int[]].get"" IL_0055: pop @@ -466,7 +466,7 @@ .locals init (C V_0) //c IL_0057: ldc.i4.3 IL_0058: newarr ""int"" IL_005d: dup - IL_005e: ldtoken "".__StaticArrayInitTypeSize=12 .$$method0x6000001-E429CCA3F703A39CC5954A6572FEC9086135B34E"" + IL_005e: ldtoken "".__StaticArrayInitTypeSize=12 .E429CCA3F703A39CC5954A6572FEC9086135B34E"" IL_0063: call ""void System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)"" IL_0068: callvirt ""int C.this[params int[]].get"" IL_006d: pop @@ -563,7 +563,7 @@ static void Main() } } "; - var compVerifier = CompileAndVerify(text); + var compVerifier = CompileAndVerify(text, options: TestOptions.ReleaseExe.WithModuleName("MODULE")); compVerifier.VerifyIL("Test.Main", @" { @@ -606,7 +606,7 @@ .locals init (C V_0) //c IL_003f: ldc.i4.3 IL_0040: newarr ""int"" IL_0045: dup - IL_0046: ldtoken "".__StaticArrayInitTypeSize=12 .$$method0x6000001-E429CCA3F703A39CC5954A6572FEC9086135B34E"" + IL_0046: ldtoken "".__StaticArrayInitTypeSize=12 .E429CCA3F703A39CC5954A6572FEC9086135B34E"" IL_004b: call ""void System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)"" IL_0050: ldc.i4.4 IL_0051: callvirt ""void C.this[params int[]].set"" @@ -614,7 +614,7 @@ .locals init (C V_0) //c IL_0057: ldc.i4.3 IL_0058: newarr ""int"" IL_005d: dup - IL_005e: ldtoken "".__StaticArrayInitTypeSize=12 .$$method0x6000001-E429CCA3F703A39CC5954A6572FEC9086135B34E"" + IL_005e: ldtoken "".__StaticArrayInitTypeSize=12 .E429CCA3F703A39CC5954A6572FEC9086135B34E"" IL_0063: call ""void System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)"" IL_0068: ldc.i4.4 IL_0069: callvirt ""void C.this[params int[]].set"" @@ -711,7 +711,7 @@ static void Main() } } "; - var compVerifier = CompileAndVerify(text); + var compVerifier = CompileAndVerify(text, options: TestOptions.ReleaseExe.WithModuleName("MODULE")); compVerifier.VerifyIL("Test.Main", @" { @@ -800,7 +800,7 @@ .locals init (C V_0, //c IL_0084: ldc.i4.3 IL_0085: newarr ""int"" IL_008a: dup - IL_008b: ldtoken "".__StaticArrayInitTypeSize=12 .$$method0x6000001-E429CCA3F703A39CC5954A6572FEC9086135B34E"" + IL_008b: ldtoken "".__StaticArrayInitTypeSize=12 .E429CCA3F703A39CC5954A6572FEC9086135B34E"" IL_0090: call ""void System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)"" IL_0095: stloc.3 IL_0096: ldloc.2 @@ -818,7 +818,7 @@ .locals init (C V_0, //c IL_00aa: ldc.i4.3 IL_00ab: newarr ""int"" IL_00b0: dup - IL_00b1: ldtoken "".__StaticArrayInitTypeSize=12 .$$method0x6000001-E429CCA3F703A39CC5954A6572FEC9086135B34E"" + IL_00b1: ldtoken "".__StaticArrayInitTypeSize=12 .E429CCA3F703A39CC5954A6572FEC9086135B34E"" IL_00b6: call ""void System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)"" IL_00bb: stloc.3 IL_00bc: ldloc.2 @@ -936,7 +936,7 @@ static void Main() } } "; - var compVerifier = CompileAndVerify(text); + var compVerifier = CompileAndVerify(text, options: TestOptions.ReleaseExe.WithModuleName("MODULE")); compVerifier.VerifyIL("Test.Main", @" { @@ -1030,7 +1030,7 @@ .locals init (C V_0, //c IL_00a2: ldc.i4.3 IL_00a3: newarr ""int"" IL_00a8: dup - IL_00a9: ldtoken "".__StaticArrayInitTypeSize=12 .$$method0x6000001-E429CCA3F703A39CC5954A6572FEC9086135B34E"" + IL_00a9: ldtoken "".__StaticArrayInitTypeSize=12 .E429CCA3F703A39CC5954A6572FEC9086135B34E"" IL_00ae: call ""void System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)"" IL_00b3: stloc.2 IL_00b4: ldloc.1 @@ -1047,7 +1047,7 @@ .locals init (C V_0, //c IL_00cb: ldc.i4.3 IL_00cc: newarr ""int"" IL_00d1: dup - IL_00d2: ldtoken "".__StaticArrayInitTypeSize=12 .$$method0x6000001-E429CCA3F703A39CC5954A6572FEC9086135B34E"" + IL_00d2: ldtoken "".__StaticArrayInitTypeSize=12 .E429CCA3F703A39CC5954A6572FEC9086135B34E"" IL_00d7: call ""void System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)"" IL_00dc: stloc.2 IL_00dd: ldloc.1 diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/SwitchTests.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/SwitchTests.cs index e9bc3a5831518..b7ce4fc5c5988 100644 --- a/src/Compilers/CSharp/Test/Emit/CodeGen/SwitchTests.cs +++ b/src/Compilers/CSharp/Test/Emit/CodeGen/SwitchTests.cs @@ -2137,7 +2137,7 @@ public static void Main() Console.WriteLine(success); } }"; - var compVerifier = CompileAndVerify(text, expectedOutput: "True"); + var compVerifier = CompileAndVerify(text, options: TestOptions.ReleaseExe.WithModuleName("MODULE"), expectedOutput: "True"); compVerifier.VerifyIL("Test.M", @" { @@ -2160,7 +2160,7 @@ .locals init (string V_0, //value IL_001a: callvirt ""string string.Remove(int, int)"" IL_001f: starg.s V_0 IL_0021: ldarg.0 - IL_0022: call ""$$method0x6000001-ComputeStringHash"" + IL_0022: call ""ComputeStringHash"" IL_0027: stloc.1 IL_0028: ldloc.1 IL_0029: ldc.i4 0xc60bf9f2 @@ -2283,7 +2283,7 @@ .locals init (string V_0, //value var reference = compVerifier.Compilation.EmitToImageReference(); var comp = CSharpCompilation.Create("Name", references: new[] { reference }, options: TestOptions.ReleaseDll.WithMetadataImportOptions(MetadataImportOptions.Internal)); - var pid = ((NamedTypeSymbol)comp.GlobalNamespace.GetMembers().Single(s => s.Name.StartsWith("", StringComparison.Ordinal))); + var pid = ((NamedTypeSymbol)comp.GlobalNamespace.GetMembers().Single(s => s.Name.StartsWith("", StringComparison.Ordinal))); var member = pid.GetMembers(PrivateImplementationDetails.SynthesizedStringHashFunctionName).Single(); Assert.Equal(Accessibility.Internal, member.DeclaredAccessibility); } @@ -2487,7 +2487,7 @@ public static void Main() Console.Write(status); } }"; - var compVerifier = CompileAndVerify(text, expectedOutput: "PASS"); + var compVerifier = CompileAndVerify(text, options: TestOptions.ReleaseExe.WithModuleName("MODULE"), expectedOutput: "PASS"); compVerifier.VerifyIL("Test.Switcheroo", @" { @@ -2508,7 +2508,7 @@ .locals init (string V_0, //value IL_0017: callvirt ""string string.Remove(int, int)"" IL_001c: starg.s V_0 IL_001e: ldarg.0 - IL_001f: call ""$$method0x6000001-ComputeStringHash"" + IL_001f: call ""ComputeStringHash"" IL_0024: stloc.1 IL_0025: ldloc.1 IL_0026: ldc.i4 0xb2f29419 @@ -6159,7 +6159,7 @@ public static void Main(string [] args) } }"; - var comp = CreateCompilationWithMscorlib(text); + var comp = CreateCompilationWithMscorlib(text, options: TestOptions.ReleaseExe.WithModuleName("MODULE")); CompileAndVerify(comp).VerifyIL("Test.Main", @" { // Code size 328 (0x148) @@ -6181,7 +6181,7 @@ .locals init (string V_0, IL_0019: ldelem.ref IL_001a: stloc.0 IL_001b: ldloc.0 - IL_001c: call ""$$method0x6000001-ComputeStringHash"" + IL_001c: call ""ComputeStringHash"" IL_0021: stloc.1 IL_0022: ldloc.1 IL_0023: ldc.i4 0xc30bf539 @@ -6326,7 +6326,7 @@ public static void Main(string [] args) } }"; - var comp = CreateCompilationWithMscorlib(text); + var comp = CreateCompilationWithMscorlib(text, options: TestOptions.ReleaseExe.WithModuleName("MODULE")); // With special members available, we use a hashtable approach. CompileAndVerify(comp).VerifyIL("Test.Main", @" @@ -6340,7 +6340,7 @@ .locals init (string V_0, IL_0002: ldelem.ref IL_0003: stloc.0 IL_0004: ldloc.0 - IL_0005: call ""$$method0x6000001-ComputeStringHash"" + IL_0005: call ""ComputeStringHash"" IL_000a: stloc.1 IL_000b: ldloc.1 IL_000c: ldc.i4 0xc30bf539 diff --git a/src/Compilers/CSharp/Test/Emit/Emit/CompilationEmitTests.cs b/src/Compilers/CSharp/Test/Emit/Emit/CompilationEmitTests.cs index 37cdbbf189a8b..8173634da5533 100644 --- a/src/Compilers/CSharp/Test/Emit/Emit/CompilationEmitTests.cs +++ b/src/Compilers/CSharp/Test/Emit/Emit/CompilationEmitTests.cs @@ -2681,5 +2681,51 @@ public void BrokenPDBStream() Assert.Equal(1, err.Arguments.Count); Assert.True(((string)err.Arguments[0]).EndsWith(" HRESULT: 0x806D0004", StringComparison.Ordinal)); } + + [Fact] + public void MultipleNetmodulesWithPrivateImplementationDetails() + { + var s1 = @" +public class A +{ + private static char[] contents = { 'H', 'e', 'l', 'l', 'o', ',', ' ' }; + public static string M1() + { + return new string(contents); + } +}"; + var s2 = @" +public class B : A +{ + private static char[] contents = { 'w', 'o', 'r', 'l', 'd', '!' }; + public static string M2() + { + return new string(contents); + } +}"; + var s3 = @" +public class Program +{ + public static void Main(string[] args) + { + System.Console.Write(A.M1()); + System.Console.WriteLine(B.M2()); + } +}"; + var comp1 = CreateCompilationWithMscorlib(s1, options: TestOptions.ReleaseModule); + comp1.VerifyDiagnostics(); + var ref1 = ModuleMetadata.CreateFromStream(comp1.EmitToStream()).GetReference(); + + var comp2 = CreateCompilationWithMscorlib(s2, options: TestOptions.ReleaseModule, references: new[] { ref1 }); + comp2.VerifyDiagnostics(); + var ref2 = ModuleMetadata.CreateFromStream(comp2.EmitToStream()).GetReference(); + + var comp3 = CreateCompilationWithMscorlib(s3, options: TestOptions.ReleaseExe, references: new[] { ref1, ref2 }); + comp3.VerifyDiagnostics( + ////// error CS0101: The namespace '' already contains a definition for '' + ////Diagnostic(ErrorCode.ERR_DuplicateNameInNS).WithArguments("", "").WithLocation(1, 1) + ); + CompileAndVerify(comp3, emitOptions: TestEmitters.RefEmitBug, expectedOutput: "Hello, world!"); + } } } diff --git a/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.cs b/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.cs index 5ba57904ebbc5..6f48c45800fc9 100644 --- a/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.cs +++ b/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.cs @@ -2502,7 +2502,7 @@ static void M() System.Console.WriteLine(a[1]); } }"; - var compilation0 = CreateCompilationWithMscorlib(source0, options: TestOptions.DebugDll); + var compilation0 = CreateCompilationWithMscorlib(source0, options: TestOptions.DebugDll.WithModuleName("MODULE")); var compilation1 = compilation0.WithSource(source1); var compilation2 = compilation1.WithSource(source2); @@ -2519,7 +2519,7 @@ .locals init (int[] V_0) //a IL_0001: ldc.i4.3 IL_0002: newarr ""int"" IL_0007: dup - IL_0008: ldtoken "".__StaticArrayInitTypeSize=12 .$$method0x6000001-E429CCA3F703A39CC5954A6572FEC9086135B34E"" + IL_0008: ldtoken "".__StaticArrayInitTypeSize=12 .E429CCA3F703A39CC5954A6572FEC9086135B34E"" IL_000d: call ""void System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)"" IL_0012: stloc.0 IL_0013: ldloc.0 @@ -2817,7 +2817,7 @@ static int F(string s) } } }"; - const string ComputeStringHashName = "$$method0x6000001-ComputeStringHash"; + const string ComputeStringHashName = "ComputeStringHash"; var compilation0 = CreateCompilationWithMscorlib(source, options: TestOptions.DebugDll); var compilation1 = compilation0.WithSource(source); @@ -2828,7 +2828,7 @@ static int F(string s) var generation0 = EmitBaseline.CreateInitialBaseline(ModuleMetadata.CreateFromImage(bytes0), methodData0.EncDebugInfoProvider()); // Should have generated call to ComputeStringHash and - // added the method to . + // added the method to . var actualIL0 = methodData0.GetMethodIL(); Assert.True(actualIL0.Contains(ComputeStringHashName)); @@ -2843,7 +2843,7 @@ static int F(string s) ImmutableArray.Create(new SemanticEdit(SemanticEditKind.Update, method0, method1, GetEquivalentNodesMap(method1, method0), preserveLocalVariables: true))); // Should not have generated call to ComputeStringHash nor - // added the method to . + // added the method to . var actualIL1 = diff1.GetMethodIL("C.F"); Assert.False(actualIL1.Contains(ComputeStringHashName)); diff --git a/src/Compilers/CSharp/Test/Emit/PDB/PDBTests.cs b/src/Compilers/CSharp/Test/Emit/PDB/PDBTests.cs index fcd7824f6fb16..4d2b2eb70ef1c 100644 --- a/src/Compilers/CSharp/Test/Emit/PDB/PDBTests.cs +++ b/src/Compilers/CSharp/Test/Emit/PDB/PDBTests.cs @@ -1109,7 +1109,7 @@ static void Main() } } "; - var v = CompileAndVerify(source, options: TestOptions.DebugDll); + var v = CompileAndVerify(source, options: TestOptions.DebugDll.WithModuleName("MODULE")); // Stepping: // After "continue", step to "in". @@ -1135,7 +1135,7 @@ .locals init (int[,,] V_0, //array IL_0003: ldc.i4.2 IL_0004: newobj ""int[*,*,*]..ctor"" IL_0009: dup - IL_000a: ldtoken "".__StaticArrayInitTypeSize=32 .$$method0x6000001-EB196F988F4F427D318CA25B68671CF3A4510012"" + IL_000a: ldtoken "".__StaticArrayInitTypeSize=32 .EB196F988F4F427D318CA25B68671CF3A4510012"" IL_000f: call ""void System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)"" IL_0014: stloc.0 -IL_0015: nop diff --git a/src/Compilers/CSharp/Test/WinRT/CodeGen/WinRTCollectionTests.cs b/src/Compilers/CSharp/Test/WinRT/CodeGen/WinRTCollectionTests.cs index e583552280a7e..65ac7179dd54b 100644 --- a/src/Compilers/CSharp/Test/WinRT/CodeGen/WinRTCollectionTests.cs +++ b/src/Compilers/CSharp/Test/WinRT/CodeGen/WinRTCollectionTests.cs @@ -5241,7 +5241,7 @@ .locals init (AllMembers.<>c__DisplayClass3_0 V_0) //CS$<>8__locals0 IL_005b: ldc.i4.5 IL_005c: newarr ""int"" IL_0061: dup - IL_0062: ldtoken "".__StaticArrayInitTypeSize=20 .$$method0x6000001-864782BF337E3DBC1A27023D5C0C065C80F17087"" + IL_0062: ldtoken "".__StaticArrayInitTypeSize=20 .864782BF337E3DBC1A27023D5C0C065C80F17087"" IL_0067: call ""void System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)"" IL_006c: ldloc.0 IL_006d: ldftn ""bool AllMembers.<>c__DisplayClass3_0.b__0(int)"" diff --git a/src/Compilers/Core/Portable/CodeGen/PrivateImplementationDetails.cs b/src/Compilers/Core/Portable/CodeGen/PrivateImplementationDetails.cs index 08b10f24a0671..b65bc28e1f3f6 100644 --- a/src/Compilers/Core/Portable/CodeGen/PrivateImplementationDetails.cs +++ b/src/Compilers/Core/Portable/CodeGen/PrivateImplementationDetails.cs @@ -23,17 +23,16 @@ internal sealed class PrivateImplementationDetails : DefaultTypeDef, Cci.INamesp { // Note: Dev11 uses the source method token as the prefix, rather than a fixed token // value, and data field offsets are unique within the method, not across all methods. - private const string MemberNamePrefix = "$$method0x6000001-"; - internal const string SynthesizedStringHashFunctionName = MemberNamePrefix + "ComputeStringHash"; + internal const string SynthesizedStringHashFunctionName = "ComputeStringHash"; - private readonly Cci.IModule _module; //parent unit + private readonly Cci.IModule _moduleBuilder; //parent unit private readonly Cci.ITypeReference _systemObject; //base type private readonly Cci.ITypeReference _systemValueType; //base for nested structs - private readonly Cci.ITypeReference _systemInt8Type; //for metadata init of short arrays + private readonly Cci.ITypeReference _systemInt8Type; //for metadata init of byte arrays private readonly Cci.ITypeReference _systemInt16Type; //for metadata init of short arrays - private readonly Cci.ITypeReference _systemInt32Type; //for metadata init of short arrays - private readonly Cci.ITypeReference _systemInt64Type; //for metadata init of short arrays + private readonly Cci.ITypeReference _systemInt32Type; //for metadata init of int arrays + private readonly Cci.ITypeReference _systemInt64Type; //for metadata init of long arrays private readonly Cci.ICustomAttribute _compilerGeneratedAttribute; @@ -57,7 +56,8 @@ internal sealed class PrivateImplementationDetails : DefaultTypeDef, Cci.INamesp private readonly ConcurrentDictionary _proxyTypes = new ConcurrentDictionary(); internal PrivateImplementationDetails( - Cci.IModule module, + Cci.IModule moduleBuilder, + string moduleName, int submissionSlotIndex, Cci.ITypeReference systemObject, Cci.ITypeReference systemValueType, @@ -67,11 +67,10 @@ internal PrivateImplementationDetails( Cci.ITypeReference systemInt64Type, Cci.ICustomAttribute compilerGeneratedAttribute) { - Debug.Assert(module != null); Debug.Assert(systemObject != null); Debug.Assert(systemValueType != null); - _module = module; + _moduleBuilder = moduleBuilder; _systemObject = systemObject; _systemValueType = systemValueType; @@ -81,12 +80,12 @@ internal PrivateImplementationDetails( _systemInt64Type = systemInt64Type; _compilerGeneratedAttribute = compilerGeneratedAttribute; - _name = GetClassName(submissionSlotIndex); + _name = GetClassName(moduleName, submissionSlotIndex); } - internal static string GetClassName(int submissionSlotIndex) + internal static string GetClassName(string moduleName, int submissionSlotIndex) { - return "" + (submissionSlotIndex >= 0 ? submissionSlotIndex.ToString() : ""); + return $"{(submissionSlotIndex >= 0 ? submissionSlotIndex.ToString() : "")}<{moduleName}>"; } internal void Freeze() @@ -197,8 +196,8 @@ public override void Dispatch(Cci.MetadataVisitor visitor) public Cci.IUnitReference GetUnit(EmitContext context) { - Debug.Assert(context.Module == _module); - return _module; + Debug.Assert(context.Module == _moduleBuilder); + return _moduleBuilder; } public string NamespaceName => string.Empty; @@ -214,7 +213,7 @@ internal static string GenerateDataFieldName(ImmutableArray data) c[i++] = Hexchar(b & 0xF); } - return MemberNamePrefix + new string(c); + return new string(c); } private static char Hexchar(int x) diff --git a/src/Compilers/Core/Portable/Emit/CommonPEModuleBuilder.cs b/src/Compilers/Core/Portable/Emit/CommonPEModuleBuilder.cs index 434c5397f4cc0..2536f2eff7eb9 100644 --- a/src/Compilers/Core/Portable/Emit/CommonPEModuleBuilder.cs +++ b/src/Compilers/Core/Portable/Emit/CommonPEModuleBuilder.cs @@ -28,16 +28,13 @@ internal abstract class CommonPEModuleBuilder /// /// Common base class for C# and VB PE module builder. /// - internal abstract class PEModuleBuilder : CommonPEModuleBuilder, Cci.IModule, ITokenDeferral + internal abstract class PEModuleBuilder : CommonPEModuleBuilder, Cci.IModule, ITokenDeferral where TCompilation : Compilation - where TSymbol : class - where TSourceModuleSymbol : class, TModuleSymbol - where TModuleSymbol : class, TSymbol - where TAssemblySymbol : class, TSymbol - where TNamespaceSymbol : class, TSymbol - where TTypeSymbol : class, TSymbol + where TSourceModuleSymbol : class, IModuleSymbol + where TAssemblySymbol : class + where TTypeSymbol : class where TNamedTypeSymbol : class, TTypeSymbol, Cci.INamespaceTypeDefinition - where TMethodSymbol : class, TSymbol, Cci.IMethodDefinition + where TMethodSymbol : class, Cci.IMethodDefinition where TSyntaxNode : SyntaxNode where TEmbeddedTypesManager : NoPia.CommonEmbeddedTypesManager where TModuleCompilationState : ModuleCompilationState @@ -654,6 +651,7 @@ internal PrivateImplementationDetails GetPrivateImplClass(TSyntaxNode syntaxNode { result = new PrivateImplementationDetails( this, + this.SourceModule.Name, _compilation.GetSubmissionSlotIndex(), this.GetSpecialType(SpecialType.System_Object, syntaxNodeOpt, diagnostics), this.GetSpecialType(SpecialType.System_ValueType, syntaxNodeOpt, diagnostics), diff --git a/src/Compilers/VisualBasic/Portable/Emit/PEModuleBuilder.vb b/src/Compilers/VisualBasic/Portable/Emit/PEModuleBuilder.vb index 1cc7f0eb45492..48b4a6d592746 100644 --- a/src/Compilers/VisualBasic/Portable/Emit/PEModuleBuilder.vb +++ b/src/Compilers/VisualBasic/Portable/Emit/PEModuleBuilder.vb @@ -12,7 +12,7 @@ Imports Microsoft.CodeAnalysis.VisualBasic.Symbols Namespace Microsoft.CodeAnalysis.VisualBasic.Emit Partial Friend MustInherit Class PEModuleBuilder - Inherits PEModuleBuilder(Of VisualBasicCompilation, Symbol, SourceModuleSymbol, ModuleSymbol, AssemblySymbol, NamespaceSymbol, TypeSymbol, NamedTypeSymbol, MethodSymbol, VisualBasicSyntaxNode, NoPia.EmbeddedTypesManager, ModuleCompilationState) + Inherits PEModuleBuilder(Of VisualBasicCompilation, SourceModuleSymbol, AssemblySymbol, TypeSymbol, NamedTypeSymbol, MethodSymbol, VisualBasicSyntaxNode, NoPia.EmbeddedTypesManager, ModuleCompilationState) ' Not many methods should end up here. Private ReadOnly _disableJITOptimization As ConcurrentDictionary(Of MethodSymbol, Boolean) = New ConcurrentDictionary(Of MethodSymbol, Boolean)(ReferenceEqualityComparer.Instance) diff --git a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenForeach.vb b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenForeach.vb index 6bc8c7de9ffcd..e40cc87183478 100644 --- a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenForeach.vb +++ b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenForeach.vb @@ -82,7 +82,7 @@ Class C End Sub End Class -, options:=TestOptions.ReleaseExe).VerifyIL("C.Main", , options:=TestOptions.ReleaseExe.WithModuleName("MODULE")).VerifyIL("C.Main", .__StaticArrayInitTypeSize=12 .$$method0x6000001-E429CCA3F703A39CC5954A6572FEC9086135B34E" + IL_0007: ldtoken ".__StaticArrayInitTypeSize=12 .E429CCA3F703A39CC5954A6572FEC9086135B34E" IL_000c: call "Sub System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)" IL_0011: stloc.0 IL_0012: ldc.i4.0 @@ -913,7 +913,7 @@ Class C End Sub End Class -, additionalRefs:={LinqAssemblyRef}, expectedOutput:=, options:=TestOptions.ReleaseExe.WithModuleName("MODULE"), additionalRefs:={LinqAssemblyRef}, expectedOutput:=.__StaticArrayInitTypeSize=12 .$$method0x6000001-E429CCA3F703A39CC5954A6572FEC9086135B34E" + IL_0007: ldtoken ".__StaticArrayInitTypeSize=12 .E429CCA3F703A39CC5954A6572FEC9086135B34E" IL_000c: call "Sub System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)" IL_0011: ldsfld "C._Closure$__.$I1-0 As System.Func(Of Integer, String)" IL_0016: brfalse.s IL_001f @@ -3028,7 +3028,7 @@ Class C End Sub End Class -, expectedOutput:=, options:=TestOptions.ReleaseExe.WithModuleName("MODULE"), expectedOutput:=.__StaticArrayInitTypeSize=12 .$$method0x6000001-E429CCA3F703A39CC5954A6572FEC9086135B34E" + IL_0007: ldtoken ".__StaticArrayInitTypeSize=12 .E429CCA3F703A39CC5954A6572FEC9086135B34E" IL_000c: call "Sub System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)" IL_0011: stloc.0 .try diff --git a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenMultiDimensionalArray.vb b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenMultiDimensionalArray.vb index 73e20cdc7b727..b8b9593e24155 100644 --- a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenMultiDimensionalArray.vb +++ b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenMultiDimensionalArray.vb @@ -19,7 +19,7 @@ public Module A End Sub End Module - , + , options:=TestOptions.ReleaseExe.WithModuleName("MODULE"), expectedOutput:="2"). VerifyIL("A.Main", .__StaticArrayInitTypeSize=24 .$$method0x6000001-D64E555B758C5B66DFAC42F18587BB1B3C9BCFA8" + IL_0008: ldtoken ".__StaticArrayInitTypeSize=24 .D64E555B758C5B66DFAC42F18587BB1B3C9BCFA8" IL_000d: call "Sub System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)" IL_0012: ldc.i4.1 IL_0013: ldc.i4.1 @@ -53,7 +53,7 @@ public Module A End Sub End Module - , + , options:=TestOptions.ReleaseExe.WithModuleName("MODULE"), expectedOutput:="42"). VerifyIL("A.Main", .__StaticArrayInitTypeSize=24 .$$method0x6000001-A4B74E064E285570B3499538C5B205C3D0972FDF" + IL_0008: ldtoken ".__StaticArrayInitTypeSize=24 .A4B74E064E285570B3499538C5B205C3D0972FDF" IL_000d: call "Sub System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)" IL_0012: dup IL_0013: ldc.i4.1 diff --git a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenSelectCase.vb b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenSelectCase.vb index 82a9e386daf52..be921c35f7f41 100644 --- a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenSelectCase.vb +++ b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenSelectCase.vb @@ -3244,7 +3244,7 @@ End Module IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldloc.0 - IL_0003: call "Function $$method0x6000001-ComputeStringHash(String) As UInteger" + IL_0003: call "Function ComputeStringHash(String) As UInteger" IL_0008: stloc.1 IL_0009: ldloc.1 IL_000a: ldc.i4 0x330ca589 @@ -3673,7 +3673,7 @@ Equal to A]]>).VerifyIL("M1.Test", -, +, options:=TestOptions.ReleaseExe.WithModuleName("MODULE"), expectedOutput:="3b").VerifyIL("M1.Main", .__StaticArrayInitTypeSize=12 .$$method0x6000001-E429CCA3F703A39CC5954A6572FEC9086135B34E" + IL_0007: ldtoken ".__StaticArrayInitTypeSize=12 .E429CCA3F703A39CC5954A6572FEC9086135B34E" IL_000c: call "Sub System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)" IL_0011: stloc.0 IL_0012: ldc.i4.2 @@ -6787,7 +6787,7 @@ Module M1 End Sub End Module -). +, options:=TestOptions.ReleaseDll.WithModuleName("MODULE")). VerifyIL("M1.M", .__StaticArrayInitTypeSize=5 .$$method0x6000001-9755240DD0C4C1AD226DEBD40C6D2EBD408250CB" + IL_0007: ldtoken ".__StaticArrayInitTypeSize=5 .9755240DD0C4C1AD226DEBD40C6D2EBD408250CB" IL_000c: call "Sub System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)" IL_0011: pop IL_0012: ldc.i4.5 IL_0013: newarr "Double" IL_0018: dup - IL_0019: ldtoken ".__StaticArrayInitTypeSize=40 .$$method0x6000001-11F3436B917FFBA0FAB0FAD5563AF18FA24AC16A" + IL_0019: ldtoken ".__StaticArrayInitTypeSize=40 .11F3436B917FFBA0FAB0FAD5563AF18FA24AC16A" IL_001e: call "Sub System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)" IL_0023: pop IL_0024: ldc.i4.5 IL_0025: newarr "Boolean" IL_002a: dup - IL_002b: ldtoken ".__StaticArrayInitTypeSize=5 .$$method0x6000001-4E724558F6B816715597A51663AD8F05247E2C4A" + IL_002b: ldtoken ".__StaticArrayInitTypeSize=5 .4E724558F6B816715597A51663AD8F05247E2C4A" IL_0030: call "Sub System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)" IL_0035: pop IL_0036: ldc.i4.5 IL_0037: newarr "Char" IL_003c: dup - IL_003d: ldtoken ".__StaticArrayInitTypeSize=10 .$$method0x6000001-E313A2813013780396D58750DC5D62221C86F42F" + IL_003d: ldtoken ".__StaticArrayInitTypeSize=10 .E313A2813013780396D58750DC5D62221C86F42F" IL_0042: call "Sub System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)" IL_0047: pop IL_0048: ret @@ -6889,7 +6889,7 @@ Module M1 End Sub End Module -)).VerifyIL("M1.M", +, options:=TestOptions.ReleaseDll.WithModuleName("MODULE"))).VerifyIL("M1.M", .__StaticArrayInitTypeSize=20 .$$method0x6000001-3191FF614021ADF3122AC274EA5B6097C21BEB81" + IL_0007: ldtoken ".__StaticArrayInitTypeSize=20 .3191FF614021ADF3122AC274EA5B6097C21BEB81" IL_000c: call "Sub System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)" IL_0011: pop IL_0012: ret @@ -10573,7 +10573,7 @@ Module Program End Sub End Module -, expectedOutput:=, options:=TestOptions.ReleaseExe.WithModuleName("MODULE"), expectedOutput:=.$$method0x6000001-35CCB1599F52363510686EF38B7DB5E7998DB108" + IL_0047: ldtoken "Integer .35CCB1599F52363510686EF38B7DB5E7998DB108" IL_004c: call "Sub System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)" IL_0051: ldc.i4.2 IL_0052: ldelem.u1 @@ -11461,7 +11461,7 @@ Module Module1 End Module -, expectedOutput:="12"). +, options:=TestOptions.ReleaseExe.WithModuleName("MODULE"), expectedOutput:="12"). VerifyIL("Module1.getTypes", .__StaticArrayInitTypeSize=16 .$$method0x6000001-1456763F890A84558F99AFA687C36B9037697848" + IL_0007: ldtoken ".__StaticArrayInitTypeSize=16 .1456763F890A84558F99AFA687C36B9037697848" IL_000c: call "Sub System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)" IL_0011: stloc.0 IL_0012: ldloc.0 diff --git a/src/Compilers/VisualBasic/Test/Emit/CodeGen/WinRTCollectionTests.vb b/src/Compilers/VisualBasic/Test/Emit/CodeGen/WinRTCollectionTests.vb index 81f6e404cb918..9c5e309e728e5 100644 --- a/src/Compilers/VisualBasic/Test/Emit/CodeGen/WinRTCollectionTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/CodeGen/WinRTCollectionTests.vb @@ -4388,6 +4388,7 @@ End Class Dim verifier = CompileAndVerify(source, additionalRefs:=LegacyRefs, emitOptions:=TestEmitters.RefEmitBug, + options:=TestOptions.ReleaseExe.WithModuleName("MODULE"), verify:=False) AssertNoErrorsOrWarnings(verifier) verifier.VerifyIL("AllMembers.TestLINQ", .__StaticArrayInitTypeSize=20 .$$method0x6000001-864782BF337E3DBC1A27023D5C0C065C80F17087" + IL_0062: ldtoken ".__StaticArrayInitTypeSize=20 .864782BF337E3DBC1A27023D5C0C065C80F17087" IL_0067: call "Sub System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)" IL_006c: ldloc.0 IL_006d: ldftn "Function AllMembers._Closure$__5-0._Lambda$__0(Integer) As Boolean" diff --git a/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinueTests.vb b/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinueTests.vb index 98d196e3e051f..80bce67ce471e 100644 --- a/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinueTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinueTests.vb @@ -444,7 +444,7 @@ Class C End Class ]]> - Dim compilation0 = CreateCompilationWithMscorlibAndVBRuntime(sources0, TestOptions.DebugDll) + Dim compilation0 = CreateCompilationWithMscorlibAndVBRuntime(sources0, TestOptions.DebugDll.WithModuleName("MODULE")) Dim compilation1 = compilation0.WithSource(sources1) Dim testData0 = New CompilationTestData() @@ -459,7 +459,7 @@ End Class IL_0001: ldc.i4.3 IL_0002: newarr ""Integer"" IL_0007: dup - IL_0008: ldtoken "".__StaticArrayInitTypeSize=12 .$$method0x6000001-E429CCA3F703A39CC5954A6572FEC9086135B34E"" + IL_0008: ldtoken "".__StaticArrayInitTypeSize=12 .E429CCA3F703A39CC5954A6572FEC9086135B34E"" IL_000d: call ""Sub System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)"" IL_0012: stloc.0 IL_0013: ldloc.0 @@ -543,7 +543,7 @@ Class C End Class ]]> - Const ComputeStringHashName As String = "$$method0x6000001-ComputeStringHash" + Const ComputeStringHashName As String = "ComputeStringHash" Dim compilation0 = CreateCompilationWithMscorlibAndVBRuntime(sources, TestOptions.DebugDll) Dim compilation1 = compilation0.WithSource(sources) @@ -554,7 +554,7 @@ End Class Dim generation0 = EmitBaseline.CreateInitialBaseline(ModuleMetadata.CreateFromImage(bytes0), methodData0.EncDebugInfoProvider) ' Should have generated call to ComputeStringHash and - ' added the method to . + ' added the method to . Dim actualIL0 = methodData0.GetMethodIL() Assert.True(actualIL0.Contains(ComputeStringHashName)) @@ -570,7 +570,7 @@ End Class ImmutableArray.Create(edit)) ' Should not have generated call to ComputeStringHash nor - ' added the method to . + ' added the method to . Dim actualIL1 = diff1.GetMethodIL("C.F") Assert.False(actualIL1.Contains(ComputeStringHashName)) diff --git a/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/ExpressionCompilerTests.cs b/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/ExpressionCompilerTests.cs index ba477c4261125..df74fa2198926 100644 --- a/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/ExpressionCompilerTests.cs +++ b/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/ExpressionCompilerTests.cs @@ -3371,7 +3371,7 @@ .maxstack 3 IL_0000: ldc.i4.5 IL_0001: newarr ""int"" IL_0006: dup - IL_0007: ldtoken "".__StaticArrayInitTypeSize=20 .$$method0x6000001-1036C5F8EF306104BD582D73E555F4DAE8EECB24"" + IL_0007: ldtoken "".__StaticArrayInitTypeSize=20 .1036C5F8EF306104BD582D73E555F4DAE8EECB24"" IL_000c: call ""void System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Array, System.RuntimeFieldHandle)"" IL_0011: ret }");