Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/Targets/Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<MicrosoftCodeAnalysisCSharpWorkspacesVersion>1.0.1</MicrosoftCodeAnalysisCSharpWorkspacesVersion>
<MicrosoftCodeAnalysisEditorFeaturesTextVersion>1.0.1</MicrosoftCodeAnalysisEditorFeaturesTextVersion>
<MicrosoftCodeAnalysisElfieVersion>0.10.6</MicrosoftCodeAnalysisElfieVersion>
<MicrosoftCodeAnalysisTestResourcesProprietaryVersion>2.0.10</MicrosoftCodeAnalysisTestResourcesProprietaryVersion>
<MicrosoftCodeAnalysisTestResourcesProprietaryVersion>2.0.11</MicrosoftCodeAnalysisTestResourcesProprietaryVersion>
<MicrosoftCodeAnalysisVisualBasicVersion>1.0.1</MicrosoftCodeAnalysisVisualBasicVersion>
<MicrosoftCodeAnalysisVisualBasicWorkspacesVersion>1.0.1</MicrosoftCodeAnalysisVisualBasicWorkspacesVersion>
<MicrosoftCodeAnalysisWorkspacesCommonVersion>1.0.1</MicrosoftCodeAnalysisWorkspacesCommonVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1547,7 +1547,7 @@ public class Test
public int P { get; set; }
}
";
var comp = CreateCompilation(source, references: new[] { SystemCoreRef });
var comp = CreateCompilation(source);
comp.VerifyDiagnostics(
// (4,13): error CS1970: Do not use 'System.Runtime.CompilerServices.DynamicAttribute'. Use the 'dynamic' keyword instead.
// [field: System.Runtime.CompilerServices.DynamicAttribute()]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1658,7 +1658,6 @@ public class C
{
static void Goo() {}
}",
new MetadataReference[] { MscorlibRef_v4_0_30316_17626 },
options: options);

using (var metadata = ModuleMetadata.CreateFromImage(other.EmitToArray()))
Expand Down
2 changes: 1 addition & 1 deletion src/Compilers/CSharp/Test/Emit/BreakingChanges.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1348,7 +1348,7 @@ static int Main()
}
";
// Native compiler throw
CompileAndVerify(source, references: new[] { SystemCoreRef }, expectedOutput: "3");
CompileAndVerify(source, expectedOutput: "3");
}

[Fact, WorkItem(530696, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530696")]
Expand Down
4 changes: 2 additions & 2 deletions src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncEHTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public CodeGenAsyncEHTests()
private CompilationVerifier CompileAndVerify(string source, string expectedOutput = null, IEnumerable<MetadataReference> references = null, CSharpCompilationOptions options = null)
{
references = (references != null) ? references.Concat(s_asyncRefs) : s_asyncRefs;
return base.CompileAndVerifyWithMscorlib40(source, expectedOutput: expectedOutput, references: references, options: options);
return base.CompileAndVerify(source, targetFramework: TargetFramework.Empty, expectedOutput: expectedOutput, references: references, options: options);
}

[Fact]
Expand Down Expand Up @@ -936,7 +936,7 @@ public static void Main()
var expected = @"
2
";
var v = CompileAndVerifyWithMscorlib40(source, s_asyncRefs, options: TestOptions.DebugExe.WithMetadataImportOptions(MetadataImportOptions.All), expectedOutput: expected, symbolValidator: module =>
var v = CompileAndVerify(source, s_asyncRefs, targetFramework: TargetFramework.Empty, options: TestOptions.DebugExe.WithMetadataImportOptions(MetadataImportOptions.All), expectedOutput: expected, symbolValidator: module =>
{
Assert.Equal(new[]
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public CodeGenAsyncLocalsTests()
private CompilationVerifier CompileAndVerify(string source, string expectedOutput = null, IEnumerable<MetadataReference> references = null, CSharpCompilationOptions options = null, Verification verify = Verification.Passes)
{
references = (references != null) ? references.Concat(s_asyncRefs) : s_asyncRefs;
return base.CompileAndVerifyWithMscorlib40(source, expectedOutput: expectedOutput, references: references, options: options, verify: verify);
return base.CompileAndVerify(source, targetFramework: TargetFramework.Empty, expectedOutput: expectedOutput, references: references, options: options, verify: verify);
}

private string GetFieldLoadsAndStores(CompilationVerifier c, string qualifiedMethodName)
Expand Down Expand Up @@ -1239,7 +1239,7 @@ public async Task F()
var b8 = await Task.FromResult(default(Tuple<long, long, long>));
}
}";
CompileAndVerifyWithMscorlib40(source, references: s_asyncRefs, options: TestOptions.ReleaseDll.WithMetadataImportOptions(MetadataImportOptions.All), symbolValidator: module =>
CompileAndVerify(source, targetFramework: TargetFramework.Empty, references: s_asyncRefs, options: TestOptions.ReleaseDll.WithMetadataImportOptions(MetadataImportOptions.All), symbolValidator: module =>
{
AssertEx.Equal(new[]
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7381,9 +7381,9 @@ static void Handler()
}
";

var comp2 = CompileAndVerifyWithMscorlib40(source2, expectedOutput:
var comp2 = CompileAndVerify(source2, targetFramework: TargetFramework.Empty, expectedOutput:
@"True
Handler", references: WinRtRefs.Concat(new[] { SystemRuntimeFacadeRef, ValueTupleRef, comp1.ToMetadataReference() }));
Handler", references: WinRtRefs.Concat(new[] { ValueTupleRef, comp1.ToMetadataReference() }));
comp2.VerifyDiagnostics();

Assert.True(comp2.Compilation.GetMember<EventSymbol>("C.E").IsWindowsRuntimeEvent);
Expand Down Expand Up @@ -7440,13 +7440,13 @@ static void Handler()
}
";

var comp2 = CompileAndVerifyWithMscorlib40(source2, expectedOutput:
var comp2 = CompileAndVerify(source2, targetFramework: TargetFramework.Empty, expectedOutput:
@"GetC
1
True
GetC
2
Handler", references: WinRtRefs.Concat(new[] { SystemRuntimeFacadeRef, ValueTupleRef, comp1.ToMetadataReference() }));
Handler", references: WinRtRefs.Concat(new[] { ValueTupleRef, comp1.ToMetadataReference() }));
comp2.VerifyDiagnostics();

Assert.True(comp2.Compilation.GetMember<EventSymbol>("S.E").IsWindowsRuntimeEvent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15419,7 +15419,7 @@ class C1
public int Length = 123;
}
";
var comp = CompileAndVerify(source, expectedOutput: "321 123", references: new[] { SystemCoreRef, CSharpRef });
var comp = CompileAndVerify(source, expectedOutput: "321 123", references: new[] { CSharpRef });
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ protected CompilationVerifier CompileAndVerifyUtil(
/// <summary>
/// Reference to an assembly that defines Expression Trees.
/// </summary>
protected new static MetadataReference ExpressionAssemblyRef => SystemCoreRef_v46;
protected static MetadataReference ExpressionAssemblyRef => SystemCoreRef_v46;


#region A string containing expression-tree dumping utilities
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ public static void Main()
// The version of mscorlib checked in to the test resources in v4_0_30316 does not have
// the IReadOnlyList<T> and IReadOnlyCollection<T> interfaces. Use the one in v4_0_30316_17626.

var mscorlib17626 = MetadataReference.CreateFromImage(TestResources.NetFX.v4_0_30316_17626.mscorlib);
var mscorlib17626 = MetadataReference.CreateFromImage(TestResources.NetFX.v4_0_30319_17626.mscorlib);
CompileAndVerify(testSrc, new MetadataReference[] { mscorlib17626 }, expectedOutput: "1", targetFramework: TargetFramework.Empty);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ int Square(int w)
}
});
}
}", references: new[] { LinqAssemblyRef });
}");
}

[Fact]
Expand Down
8 changes: 3 additions & 5 deletions src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenOperators.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2150,8 +2150,7 @@ static int Main()
// using System.Linq;
Diagnostic(ErrorCode.HDN_UnusedUsingDirective, "using System.Linq;").WithLocation(3, 1)
);
CompileAndVerify(source, references: new[] { LinqAssemblyRef },
expectedOutput: "0");
CompileAndVerify(source, expectedOutput: "0");
}

[WorkItem(543109, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543109")]
Expand All @@ -2172,8 +2171,7 @@ static int Main()
return (errCount > 0) ? 1 : 0;
}
}";
CompileAndVerify(source, references: new[] { LinqAssemblyRef },
expectedOutput: "0");
CompileAndVerify(source, expectedOutput: "0");
}

[WorkItem(543377, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543377")]
Expand Down Expand Up @@ -4412,7 +4410,7 @@ static void Main(string[] args)
}
";

var comp = CompileAndVerify(new string[] { source }, references: new[] { SystemCoreRef }, expectedOutput: @"");
var comp = CompileAndVerify(new string[] { source }, expectedOutput: @"");
// var comp = CompileAndVerify(source);
comp.VerifyDiagnostics();
comp.VerifyIL("Program.Main", @"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1169,7 +1169,7 @@ void M()
int x = 5;
x.M();
}
}", references: new[] { SystemCoreRef }, verify: Verification.Fails).VerifyIL("Test.M", @"
}", verify: Verification.Fails).VerifyIL("Test.M", @"
{
// Code size 11 (0xb)
.maxstack 1
Expand Down Expand Up @@ -1198,7 +1198,7 @@ void M()
{
x.M();
}
}", references: new[] { SystemCoreRef }, verify: Verification.Fails).VerifyIL("Test.M", @"
}", verify: Verification.Fails).VerifyIL("Test.M", @"
{
// Code size 13 (0xd)
.maxstack 1
Expand All @@ -1225,7 +1225,7 @@ void M()
{
x.M().M().M();
}
}", references: new[] { SystemCoreRef }, verify: Verification.Fails).VerifyIL("Test.M", @"
}", verify: Verification.Fails).VerifyIL("Test.M", @"
{
// Code size 23 (0x17)
.maxstack 1
Expand Down Expand Up @@ -1253,7 +1253,7 @@ void M()
{
5.M();
}
}", references: new[] { SystemCoreRef }, verify: Verification.Fails).VerifyIL("Test.M", @"
}", verify: Verification.Fails).VerifyIL("Test.M", @"
{
// Code size 11 (0xb)
.maxstack 1
Expand Down Expand Up @@ -1282,7 +1282,7 @@ void M()
int x = 5;
x.M();
}
}", references: new[] { SystemCoreRef }, verify: Verification.Fails).VerifyIL("Test.M", @"
}", verify: Verification.Fails).VerifyIL("Test.M", @"
{
// Code size 11 (0xb)
.maxstack 1
Expand Down Expand Up @@ -1311,7 +1311,7 @@ void M()
{
x.M();
}
}", references: new[] { SystemCoreRef }, verify: Verification.Fails).VerifyIL("Test.M", @"
}", verify: Verification.Fails).VerifyIL("Test.M", @"
{
// Code size 13 (0xd)
.maxstack 1
Expand All @@ -1338,7 +1338,7 @@ void M()
{
x.M().M().M();
}
}", references: new[] { SystemCoreRef }, verify: Verification.Fails).VerifyIL("Test.M", @"
}", verify: Verification.Fails).VerifyIL("Test.M", @"
{
// Code size 23 (0x17)
.maxstack 1
Expand Down
4 changes: 2 additions & 2 deletions src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenTupleTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3086,7 +3086,7 @@ static void Main()
model.GetDeclaredSymbol(x).ToTestDisplayString());
};

var verifier = CompileAndVerify(source, expectedOutput: @"1 2 3 4 5 6 7 Alice 2 3 4 5", references: new[] { MscorlibRef }, sourceSymbolValidator: validator);
var verifier = CompileAndVerify(source, expectedOutput: @"1 2 3 4 5 6 7 Alice 2 3 4 5", sourceSymbolValidator: validator);
verifier.VerifyDiagnostics();
}

Expand Down Expand Up @@ -15261,7 +15261,7 @@ public void TargetTyping_03()
class Class { void Method() { tuple = (1, ""hello""); } }
" + trivial2uple + tupleattributes_cs;

var comp = CreateCompilation(source, references: new[] { SystemRef });
var comp = CreateCompilation(source);
comp.VerifyDiagnostics(
// (2,31): error CS0103: The name 'tuple' does not exist in the current context
// class Class { void Method() { tuple = (1, "hello"); } }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1347,7 +1347,7 @@ static void Main()
2
3";

var compVerifier = CompileAndVerify(source, references: new[] { SystemCoreRef, CSharpRef }, expectedOutput: expectedOutput);
var compVerifier = CompileAndVerify(source, references: new[] { CSharpRef }, expectedOutput: expectedOutput);
compVerifier.VerifyIL("A.Main()", @"
{
// Code size 194 (0xc2)
Expand Down Expand Up @@ -1485,7 +1485,7 @@ static void Main()
get
3";

var compVerifier = CompileAndVerify(source, references: new[] { SystemCoreRef, CSharpRef }, expectedOutput: expectedOutput);
var compVerifier = CompileAndVerify(source, references: new[] { CSharpRef }, expectedOutput: expectedOutput);
compVerifier.VerifyIL("A.Main()", @"
{
// Code size 222 (0xde)
Expand Down Expand Up @@ -1871,7 +1871,7 @@ public Dictionary<string, int> this[string arg]
";
string expectedOutput = @"422";

var compVerifier = CompileAndVerify(source, references: new[] { SystemCoreRef, CSharpRef }, expectedOutput: expectedOutput);
var compVerifier = CompileAndVerify(source, references: new[] { CSharpRef }, expectedOutput: expectedOutput);
}

[Fact]
Expand Down
2 changes: 1 addition & 1 deletion src/Compilers/CSharp/Test/Emit/CodeGen/PatternTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ static void Main(string[] args)
System.Console.WriteLine(null != (x as Derived));
}
}";
var compilation = CreateCompilation(source, options: TestOptions.DebugExe, references: new[] { LinqAssemblyRef });
var compilation = CreateCompilation(source, options: TestOptions.DebugExe);
compilation.VerifyDiagnostics();
var expectedOutput =
@"True
Expand Down
10 changes: 5 additions & 5 deletions src/Compilers/CSharp/Test/Emit/CodeGen/UnsafeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4282,7 +4282,7 @@ public static ref int GetPinnableReference(this Fixable? f)

";

var compVerifier = CompileAndVerify(text, references: new[] { ExtensionAssemblyRef },options: TestOptions.UnsafeReleaseExe, expectedOutput: @"2", verify: Verification.Fails);
var compVerifier = CompileAndVerify(text,options: TestOptions.UnsafeReleaseExe, expectedOutput: @"2", verify: Verification.Fails);

compVerifier.VerifyIL("C.Main", @"
{
Expand Down Expand Up @@ -4513,7 +4513,7 @@ public static ref int GetPinnableReference<T>(this T dummy)
}
";

var compVerifier = CompileAndVerify(text, references: new[] { ExtensionAssemblyRef }, options: TestOptions.UnsafeReleaseExe, expectedOutput: @"20", verify: Verification.Fails);
var compVerifier = CompileAndVerify(text, options: TestOptions.UnsafeReleaseExe, expectedOutput: @"20", verify: Verification.Fails);

compVerifier.VerifyIL("C.Test<T>(T)", @"
{
Expand Down Expand Up @@ -4828,7 +4828,7 @@ public static ref int GetPinnableReference<T>(ref this T f) where T: struct, IFi
}
";

var compVerifier = CompileAndVerify(text, references: new[] { ExtensionAssemblyRef }, options: TestOptions.UnsafeReleaseExe, verify: Verification.Fails, expectedOutput: @"5456");
var compVerifier = CompileAndVerify(text, options: TestOptions.UnsafeReleaseExe, verify: Verification.Fails, expectedOutput: @"5456");

compVerifier.VerifyIL("C.Test<T>(ref T)", @"
{
Expand Down Expand Up @@ -4888,7 +4888,7 @@ public static ref readonly int GetPinnableReference(in this Fixable f)

";

var compVerifier = CompileAndVerify(text, references: new[] { ExtensionAssemblyRef }, options: TestOptions.UnsafeReleaseExe, expectedOutput: @"23", verify: Verification.Fails);
var compVerifier = CompileAndVerify(text, options: TestOptions.UnsafeReleaseExe, expectedOutput: @"23", verify: Verification.Fails);

compVerifier.VerifyIL("C.Main", @"
{
Expand Down Expand Up @@ -4966,7 +4966,7 @@ public static ref int GetPinnableReference(ref this Fixable f)

";

var compVerifier = CompileAndVerify(text, references: new[] { ExtensionAssemblyRef }, options: TestOptions.UnsafeReleaseExe, expectedOutput: @"3", verify: Verification.Fails);
var compVerifier = CompileAndVerify(text, options: TestOptions.UnsafeReleaseExe, expectedOutput: @"3", verify: Verification.Fails);

compVerifier.VerifyIL("C.Main", @"
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4898,7 +4898,7 @@ static int M(dynamic d, object o)
return d(ref o, 2);
}
}";
var compilation = CreateCompilation(source, options: TestOptions.ReleaseDll, references: new[] { SystemCoreRef, CSharpRef });
var compilation = CreateCompilation(source, options: TestOptions.ReleaseDll, references: new[] { CSharpRef });
var bytes = compilation.EmitToArray();
using (var metadata = ModuleMetadata.CreateFromImage(bytes))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5149,7 +5149,7 @@ public async Task<int> F()
}
");

var compilation0 = CreateEmptyCompilation(new[] { source0.Tree }, new[] { TestReferences.NetFx.v4_0_30316_17626.mscorlib }, options: ComSafeDebugDll);
var compilation0 = CreateEmptyCompilation(new[] { source0.Tree }, new[] { TestReferences.NetFx.v4_0_30319_17626.mscorlib }, options: ComSafeDebugDll);
var compilation1 = compilation0.WithSource(source1.Tree);

Assert.NotNull(compilation0.GetWellKnownTypeMember(WellKnownMember.System_Runtime_CompilerServices_AsyncStateMachineAttribute__ctor));
Expand Down Expand Up @@ -5367,7 +5367,7 @@ public object F()
}
");

var compilation0 = CreateEmptyCompilation(new[] { source0.Tree }, new[] { TestReferences.NetFx.v4_0_30316_17626.mscorlib }, options: ComSafeDebugDll.WithMetadataImportOptions(MetadataImportOptions.All));
var compilation0 = CreateEmptyCompilation(new[] { source0.Tree }, new[] { TestReferences.NetFx.v4_0_30319_17626.mscorlib }, options: ComSafeDebugDll.WithMetadataImportOptions(MetadataImportOptions.All));
var compilation1 = compilation0.WithSource(source1.Tree);

Assert.NotNull(compilation0.GetWellKnownTypeMember(WellKnownMember.System_Runtime_CompilerServices_AsyncStateMachineAttribute__ctor));
Expand Down
2 changes: 1 addition & 1 deletion src/Compilers/CSharp/Test/Emit/Emit/NoPiaEmbedTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1991,7 +1991,7 @@ .locals init (ITest28 V_0)

verifier.VerifyIL("UsePia.Test", expected);

compilation = CreateCompilation(consumer,
compilation = CreateEmptyCompilation(consumer,
new MetadataReference[] { MscorlibRef_v4_0_30316_17626, piaCompilation.EmitToImageReference(embedInteropTypes: true) },
options: TestOptions.DebugExe);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ static void Report(object o)
3");
var comp2b = CreateCompilation(
source2,
references: new[] { SystemRef, MetadataReference.CreateFromStream(comp1.EmitToStream()) },
references: new[] { MetadataReference.CreateFromStream(comp1.EmitToStream()) },
options: TestOptions.DebugExe);
comp2b.VerifyDiagnostics();
CompileAndVerify(comp2b, expectedOutput:
Expand Down
2 changes: 1 addition & 1 deletion src/Compilers/CSharp/Test/Emit/PDB/PDBAsyncTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2058,7 +2058,7 @@ static async Task M()
}
}
}";
var v = CreateCompilationWithMscorlib40(src, LatestVbReferences, options: TestOptions.DebugDll);
var v = CreateEmptyCompilation(src, LatestVbReferences, options: TestOptions.DebugDll);

v.VerifyPdb("C+<M>d__0.MoveNext", @"
<symbols>
Expand Down
4 changes: 2 additions & 2 deletions src/Compilers/CSharp/Test/Emit/PDB/PDBUsingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2184,7 +2184,7 @@ static void Main()
}
}
";
var comp = CreateCompilation(source, new[] { SystemCoreRef.WithAliases(new[] { "A" }), SystemDataRef });
var comp = CreateCompilationWithMscorlib40(source, new[] { SystemCoreRef.WithAliases(new[] { "A" }), SystemDataRef });
var v = CompileAndVerify(comp, validator: (peAssembly) =>
{
var reader = peAssembly.ManifestModule.MetadataReader;
Expand Down Expand Up @@ -2528,7 +2528,7 @@ class C5 { void F() {} }
class C6 { void F() {} }
" };

var c = CreateCompilation(sources, new[] { SystemCoreRef.WithAliases(ImmutableArray.Create("A")) });
var c = CreateCompilationWithMscorlib40(sources, new[] { SystemCoreRef.WithAliases(ImmutableArray.Create("A")) });
var pdbStream = new MemoryStream();
c.EmitToArray(EmitOptions.Default.WithDebugInformationFormat(DebugInformationFormat.PortablePdb), pdbStream: pdbStream);
var pdbImage = pdbStream.ToImmutable();
Expand Down
Loading