Skip to content

Commit

Permalink
Move net451 test assets to net461 (#74766)
Browse files Browse the repository at this point in the history
* Move net451 test assets to net461

* great rename

* PR feedback
  • Loading branch information
jaredpar authored Aug 17, 2024
1 parent 7d94086 commit 75b26a2
Show file tree
Hide file tree
Showing 250 changed files with 2,678 additions and 2,829 deletions.
1 change: 0 additions & 1 deletion eng/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@
<PackageVersion Include="Microsoft.Internal.Performance.CodeMarkers.DesignTime" Version="15.8.27812-alpha" />
<PackageVersion Include="Microsoft.NETFramework.ReferenceAssemblies.net472" Version="1.0.3" />
<PackageVersion Include="Microsoft.NETFramework.ReferenceAssemblies.net461" Version="1.0.3" />
<PackageVersion Include="Microsoft.NETFramework.ReferenceAssemblies.net451" Version="1.0.3" />
<PackageVersion Include="Microsoft.NETFramework.ReferenceAssemblies.net45" Version="1.0.3" />
<PackageVersion Include="Microsoft.NETFramework.ReferenceAssemblies.net40" Version="1.0.3" />
<PackageVersion Include="Microsoft.NETFramework.ReferenceAssemblies.net20" Version="1.0.3" />
Expand Down
4 changes: 2 additions & 2 deletions src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4341,7 +4341,7 @@ public void AppConfigBasic()
</configuration>");

var silverlight = Temp.CreateFile().WriteAllBytes(ProprietaryTestResources.silverlight_v5_0_5_0.System_v5_0_5_0_silverlight).Path;
var net4_0dll = Temp.CreateFile().WriteAllBytes(ResourcesNet451.System).Path;
var net4_0dll = Temp.CreateFile().WriteAllBytes(Net461.Resources.System).Path;

// Test linking two appconfig dlls with simple src
var outWriter = new StringWriter(CultureInfo.InvariantCulture);
Expand Down Expand Up @@ -6310,7 +6310,7 @@ public class CS1698_a {}
[ConditionalFact(typeof(ClrOnly), Reason = "https://github.com/dotnet/roslyn/issues/30926")]
public void BinaryFileErrorTest()
{
var binaryPath = Temp.CreateFile().WriteAllBytes(ResourcesNet451.mscorlib).Path;
var binaryPath = Temp.CreateFile().WriteAllBytes(Net461.Resources.mscorlib).Path;
var csc = CreateCSharpCompiler(null, WorkingDirectory, new[] { "/nologo", "/preferreduilang:en", binaryPath });
var outWriter = new StringWriter(CultureInfo.InvariantCulture);
int exitCode = csc.Run(outWriter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using Basic.Reference.Assemblies;
using Microsoft.CodeAnalysis.CSharp.Test.Utilities;
using Microsoft.CodeAnalysis.Test.Resources.Proprietary;
using Microsoft.CodeAnalysis.Test.Utilities;
Expand Down Expand Up @@ -78,7 +79,7 @@ public void AppConfigCsc()
</configuration>").Path;

var silverlight = Temp.CreateFile().WriteAllBytes(ProprietaryTestResources.silverlight_v5_0_5_0.System_v5_0_5_0_silverlight).Path;
var net4_0dll = Temp.CreateFile().WriteAllBytes(ResourcesNet451.System).Path;
var net4_0dll = Temp.CreateFile().WriteAllBytes(Net461.Resources.System).Path;

var outWriter = new StringWriter(CultureInfo.InvariantCulture);
var cmd = CreateCSharpCompiler(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -958,8 +958,8 @@ public static void Main()
Run();
}
}";
var reference = CreateCompilationWithMscorlib45(source, references: new MetadataReference[] { SystemRef_v4_0_30319_17929 }).EmitToImageReference();
var comp = CreateCompilationWithMscorlib45("", new[] { reference }, options: TestOptions.ReleaseDll.WithMetadataImportOptions(MetadataImportOptions.Internal));
var reference = CreateCompilationWithMscorlib461(source, references: new MetadataReference[] { SystemRef_v4_0_30319_17929 }).EmitToImageReference();
var comp = CreateCompilationWithMscorlib461("", new[] { reference }, options: TestOptions.ReleaseDll.WithMetadataImportOptions(MetadataImportOptions.Internal));
var testClass = comp.GlobalNamespace.GetMember<NamedTypeSymbol>("Test");
var stateMachineClass = (NamedTypeSymbol)testClass.GetMembers().Single(s => s.Name.StartsWith("<Run>", StringComparison.Ordinal));
IEnumerable<IGrouping<TypeSymbol, FieldSymbol>> spillFieldsByType = stateMachineClass.GetMembers().Where(m => m.Kind == SymbolKind.Field && m.Name.StartsWith("<>7__wrap", StringComparison.Ordinal)).Cast<FieldSymbol>().GroupBy(x => x.Type);
Expand Down
82 changes: 41 additions & 41 deletions src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncMainTests.cs

Large diffs are not rendered by default.

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ private static CSharpCompilation CreateCompilation(string source, IEnumerable<Me
{
options = options ?? TestOptions.ReleaseExe;

IEnumerable<MetadataReference> asyncRefs = new[] { Net451.System, Net451.SystemCore, Net451.MicrosoftCSharp };
IEnumerable<MetadataReference> asyncRefs = new[] { NetFramework.System, NetFramework.SystemCore, NetFramework.MicrosoftCSharp };
references = (references != null) ? references.Concat(asyncRefs) : asyncRefs;

return CreateCompilationWithMscorlib45(source, options: options, references: references);
return CreateCompilationWithMscorlib461(source, options: options, references: references);
}

private CompilationVerifier CompileAndVerify(string source, string expectedOutput, IEnumerable<MetadataReference> references = null, CSharpCompilationOptions options = null, Verification verify = default)
Expand Down Expand Up @@ -54,7 +54,7 @@ public static void Main()
F(123).Wait();
}
}";
var c = CreateCompilationWithMscorlib45(source);
var c = CreateCompilationWithMscorlib461(source);

CompilationOptions options;

Expand Down Expand Up @@ -3703,7 +3703,7 @@ public void AsyncTasklikeMissingBuilderType()
{
// Builder
var libB = @"public class B { }";
var cB = CreateCompilationWithMscorlib45(libB);
var cB = CreateCompilationWithMscorlib461(libB);
var rB = cB.EmitToImageReference();

// Tasklike
Expand All @@ -3714,7 +3714,7 @@ public void AsyncTasklikeMissingBuilderType()
namespace System.Runtime.CompilerServices { class AsyncMethodBuilderAttribute : System.Attribute { public AsyncMethodBuilderAttribute(System.Type t) { } } }
";
var cT = CreateCompilationWithMscorlib45(libT, references: new[] { rB });
var cT = CreateCompilationWithMscorlib461(libT, references: new[] { rB });
var rT = cT.EmitToImageReference();

// Consumer, fails to reference builder
Expand All @@ -3726,7 +3726,7 @@ static void Main() { }
async T f() => await Task.Delay(1);
}
";
var c = CreateCompilationWithMscorlib45(source, references: new[] { rT });
var c = CreateCompilationWithMscorlib461(source, references: new[] { rT });
c.VerifyEmitDiagnostics(
// (6,17): error CS1983: The return type of an async method must be void, Task or Task<T>
// async T f() => await Task.Delay(1);
Expand Down Expand Up @@ -4023,7 +4023,7 @@ class Mismatch2MethodBuilder<T>
}
namespace System.Runtime.CompilerServices { class AsyncMethodBuilderAttribute : System.Attribute { public AsyncMethodBuilderAttribute(System.Type t) { } } }
";
var comp = CreateCompilationWithMscorlib45(source);
var comp = CreateCompilationWithMscorlib461(source);
comp.VerifyEmitDiagnostics(
// (5,30): error CS8940: A generic task-like return type was expected, but the type 'Mismatch1MethodBuilder' found in 'AsyncMethodBuilder' attribute was not suitable. It must be an unbound generic type of arity one, and its containing type (if any) must be non-generic.
// async Mismatch1<int> f() { await (Task)null; return 1; }
Expand Down Expand Up @@ -4501,7 +4501,7 @@ public void AwaitInScriptExpression()
{
var source =
@"System.Console.WriteLine(await System.Threading.Tasks.Task.FromResult(1));";
var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe);
var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe);
compilation.VerifyDiagnostics();
}

Expand All @@ -4510,7 +4510,7 @@ public void AwaitInScriptGlobalStatement()
{
var source =
@"await System.Threading.Tasks.Task.FromResult(4);";
var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe);
var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe);
compilation.VerifyDiagnostics();
}

Expand All @@ -4520,7 +4520,7 @@ public void AwaitInScriptDeclaration()
var source =
@"int x = await System.Threading.Tasks.Task.Run(() => 2);
System.Console.WriteLine(x);";
var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe);
var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe);
compilation.VerifyDiagnostics();
}

Expand Down Expand Up @@ -4564,7 +4564,7 @@ public void AwaitInScriptStaticInitializer()
await System.Threading.Tasks.Task.FromResult(1);
int y = x +
await System.Threading.Tasks.Task.FromResult(2);";
var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe);
var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe);
compilation.VerifyDiagnostics(
// (2,5): error CS8100: The 'await' operator cannot be used in a static script variable initializer.
// await System.Threading.Tasks.Task.FromResult(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1067,7 +1067,7 @@ public interface IAaa
";

var compilation = CreateCompilationWithMscorlib45AndCSharp(source, options: TestOptions.ReleaseExe.WithAllowUnsafe(true));
var compilation = CreateCompilationWithMscorlib461AndCSharp(source, options: TestOptions.ReleaseExe.WithAllowUnsafe(true));
CompileAndVerify(compilation);
}

Expand Down
Loading

0 comments on commit 75b26a2

Please sign in to comment.