Skip to content

Move to the real System.ValueTuple ref #74936

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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 eng/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<MicrosoftCodeAnalysisNetAnalyzersVersion>8.0.0-preview.23468.1</MicrosoftCodeAnalysisNetAnalyzersVersion>
<MicrosoftCodeAnalysisTestingVersion>1.1.3-beta1.24319.1</MicrosoftCodeAnalysisTestingVersion>
<MicrosoftVisualStudioExtensibilityTestingVersion>0.1.187-beta</MicrosoftVisualStudioExtensibilityTestingVersion>
<_BasicReferenceAssembliesVersion>1.7.7</_BasicReferenceAssembliesVersion>
<_BasicReferenceAssembliesVersion>1.7.8</_BasicReferenceAssembliesVersion>
<!-- CodeStyleAnalyzerVersion should we updated together with version of dotnet-format in dotnet-tools.json -->
<CodeStyleAnalyzerVersion>4.8.0-3.final</CodeStyleAnalyzerVersion>
<VisualStudioEditorPackagesVersion>17.10.191</VisualStudioEditorPackagesVersion>
Expand Down
8 changes: 0 additions & 8 deletions src/Compilers/Test/Core/Mocks/TestReferences.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,6 @@ public static class Minimal
public static PortableExecutableReference minasynccorlib => s_minasynccorlib.Value;
}

public static class ValueTuple
{
private static readonly Lazy<PortableExecutableReference> s_tuplelib = new Lazy<PortableExecutableReference>(
() => AssemblyMetadata.CreateFromImage(TestResources.NetFX.ValueTuple.tuplelib).GetReference(display: "System.ValueTuple.dll"),
LazyThreadSafetyMode.PublicationOnly);
public static PortableExecutableReference tuplelib => s_tuplelib.Value;
}

public static class silverlight_v5_0_5_0
{
private static readonly Lazy<PortableExecutableReference> s_system = new Lazy<PortableExecutableReference>(
Expand Down
38 changes: 20 additions & 18 deletions src/Compilers/Test/Core/TargetFrameworkUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,7 @@
/// <remarks>
/// Need to special case tuples until we move to net472
/// </remarks>
public static ImmutableArray<MetadataReference> References { get; } =
ImmutableArray
.CreateRange<MetadataReference>(Net461.References.All)
.Add(NetFx.ValueTuple.tuplelib);
public static ImmutableArray<MetadataReference> References { get; } = [.. Net461.References.All, Net461.ExtraReferences.SystemValueTuple];

/// <summary>
/// This is a limited set of references on this .NET Framework TFM. This should be avoided in new code
Expand All @@ -132,13 +129,14 @@
/// Need to special case tuples until we move to net472
/// </remarks>
public static ImmutableArray<MetadataReference> Standard { get; } =
ImmutableArray.Create<MetadataReference>(
[
Net461.References.mscorlib,
Net461.References.System,
Net461.References.SystemCore,
Net461.References.SystemData,
NetFx.ValueTuple.tuplelib,
Net461.References.SystemRuntime);
Net461.References.SystemRuntime,
Net461.ExtraReferences.SystemValueTuple
];

public static PortableExecutableReference mscorlib { get; } = Net461.References.mscorlib;
public static PortableExecutableReference System { get; } = Net461.References.System;
Expand All @@ -147,6 +145,7 @@
public static PortableExecutableReference SystemData { get; } = Net461.References.SystemData;
public static PortableExecutableReference SystemThreadingTasks { get; } = Net461.References.SystemThreadingTasks;
public static PortableExecutableReference SystemXml { get; } = Net461.References.SystemXml;
public static PortableExecutableReference SystemValueTuple { get; } = Net461.ExtraReferences.SystemValueTuple;
public static PortableExecutableReference MicrosoftCSharp { get; } = Net461.References.MicrosoftCSharp;
public static PortableExecutableReference MicrosoftVisualBasic { get; } = Net461.References.MicrosoftVisualBasic;
}
Expand Down Expand Up @@ -180,25 +179,28 @@
[
TestBase.MinAsyncCorlibRef
];
public static ImmutableArray<MetadataReference> Mscorlib45ExtendedReferences =>

/*
* ⚠ Dev note ⚠: TestBase properties end here.
*/
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment was moved up because the properties below no longer depend on TestBase


public static ImmutableArray<MetadataReference> Mscorlib45ExtendedReferences { get; } =
[
NetFramework.mscorlib,
NetFramework.System,
NetFramework.SystemCore,
TestBase.ValueTupleRef,
NetFramework.SystemRuntime
NetFramework.SystemRuntime,
NetFramework.SystemValueTuple,
];
public static ImmutableArray<MetadataReference> Mscorlib46ExtendedReferences =>
public static ImmutableArray<MetadataReference> Mscorlib46ExtendedReferences { get; } =
[
Net461.References.mscorlib,
Net461.References.System,
Net461.References.SystemCore,
TestBase.ValueTupleRef,
Net461.References.SystemRuntime
Net461.References.SystemRuntime,
Net461.ExtraReferences.SystemValueTuple,
];
/*
* ⚠ Dev note ⚠: TestBase properties end here.
*/

Check failure on line 203 in src/Compilers/Test/Core/TargetFrameworkUtil.cs

View check run for this annotation

Azure Pipelines / roslyn-CI (Correctness Correctness_Analyzers)

src/Compilers/Test/Core/TargetFrameworkUtil.cs#L203

src/Compilers/Test/Core/TargetFrameworkUtil.cs(203,1): error IDE2000: (NETCORE_ENGINEERING_TELEMETRY=Build) Avoid multiple blank lines (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide2000)

Check failure on line 203 in src/Compilers/Test/Core/TargetFrameworkUtil.cs

View check run for this annotation

Azure Pipelines / roslyn-CI (Correctness Correctness_Analyzers)

src/Compilers/Test/Core/TargetFrameworkUtil.cs#L203

src/Compilers/Test/Core/TargetFrameworkUtil.cs(203,1): error IDE2000: (NETCORE_ENGINEERING_TELEMETRY=Build) Avoid multiple blank lines (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide2000)

public static ImmutableArray<MetadataReference> Mscorlib40References { get; } =
[
Expand Down Expand Up @@ -238,8 +240,8 @@
Net461.References.mscorlib,
Net461.References.System,
Net461.References.SystemCore,
NetFx.ValueTuple.tuplelib,
Net461.References.SystemRuntime
Net461.References.SystemRuntime,
Net461.ExtraReferences.SystemValueTuple,
];
public static ImmutableArray<MetadataReference> Mscorlib461AndCSharpReferences { get; } =
[
Expand Down
2 changes: 1 addition & 1 deletion src/Compilers/Test/Core/TestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public virtual void Dispose()

public static MetadataReference MinAsyncCorlibRef => TestReferences.NetFx.Minimal.minasynccorlib;

public static MetadataReference ValueTupleRef => TestReferences.NetFx.ValueTuple.tuplelib;
public static MetadataReference ValueTupleRef => NetFramework.SystemValueTuple;

public static MetadataReference MsvbRef => NetFramework.MicrosoftVisualBasic;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@
<Content Include="NetFX\Minimal\minasync.cs" />
<EmbeddedResource Include="NetFX\Minimal\minasynccorlib.dll" />
<Content Include="NetFX\Minimal\mincorlib.cs" />
<EmbeddedResource Include="NetFX\ValueTuple\System.ValueTuple.dll" />
<EmbeddedResource Include="SymbolsTests\Metadata\public-and-private.dll" />
<EmbeddedResource Include="SymbolsTests\CustomModifiers\GenericMethodWithModifiers.dll" />
<Content Include="SymbolsTests\NoPia\ParametersWithoutNames.cs" />
Expand Down
Binary file not shown.
3 changes: 0 additions & 3 deletions src/Compilers/Test/Resources/Core/TestResources.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,6 @@ public static class Minimal

public static class ValueTuple
{
private static byte[] s_tuplelib;
public static byte[] tuplelib => ResourceLoader.GetOrCreateResource(ref s_tuplelib, "NetFX.ValueTuple.System.ValueTuple.dll");

private static string s_tuplelib_cs;
public static string tuplelib_cs => ResourceLoader.GetOrCreateResource(ref s_tuplelib_cs, "NetFX.ValueTuple.ValueTuple.cs");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5020,7 +5020,7 @@ End Class
SymbolDisplayPartKind.Space,
SymbolDisplayPartKind.StructName,
SymbolDisplayPartKind.Punctuation},
references:={MetadataReference.CreateFromImage(TestResources.NetFX.ValueTuple.tuplelib)})
references:={Net461.ExtraReferences.SystemValueTuple})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Net461.ExtraReferences.SystemValueTuple

Should we just use the legacy reference here, to avoid changing the expected result?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about that but symbol display is a user visible artifact. Decided that it was better to have our tests track down Tuple displays in the 99.999% case vs. the .001% case that I'm not sure you can reaally achieve.

End Sub

<Fact()>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public virtual Task InitializeAsync()
AssemblyResolver.TestAccessor.AddInMemoryImage(TestBase.MscorlibRef_v46, "mscorlib.v4_6_1038_0.dll", ImmutableArray.Create(Net461.ReferenceInfos.mscorlib.ImageBytes));
AssemblyResolver.TestAccessor.AddInMemoryImage(TestBase.SystemRef_v46, "System.v4_6_1038_0.dll", ImmutableArray.Create(Net461.ReferenceInfos.System.ImageBytes));
AssemblyResolver.TestAccessor.AddInMemoryImage(TestBase.SystemCoreRef_v46, "System.Core.v4_6_1038_0.dll", ImmutableArray.Create(Net461.ReferenceInfos.SystemCore.ImageBytes));
AssemblyResolver.TestAccessor.AddInMemoryImage(TestBase.ValueTupleRef, "System.ValueTuple.dll", ImmutableArray.Create(TestResources.NetFX.ValueTuple.tuplelib));
AssemblyResolver.TestAccessor.AddInMemoryImage(TestBase.ValueTupleRef, "System.ValueTuple.dll", ImmutableArray.Create(Net461.ExtraReferenceInfos.SystemValueTuple.ImageBytes));
AssemblyResolver.TestAccessor.AddInMemoryImage(TestBase.SystemRuntimeFacadeRef, "System.Runtime.dll", ImmutableArray.Create(Net461.Resources.SystemRuntime));
AssemblyResolver.TestAccessor.AddInMemoryImage(TestBase.MsvbRef, "Microsoft.VisualBasic.dll", ImmutableArray.Create(Net461.Resources.MicrosoftVisualBasic));
AssemblyResolver.TestAccessor.AddInMemoryImage(TestBase.SystemXmlRef, "System.Xml.v4_0_30319.dll", ImmutableArray.Create(Net461.Resources.SystemXml));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private SyntaxGenerator Generator
public static Compilation Compile(string code)
{
return CSharpCompilation.Create("test")
.AddReferences(NetFramework.mscorlib, NetFramework.System, NetFramework.SystemCore, NetFramework.SystemRuntime, TestReferences.NetFx.ValueTuple.tuplelib)
.AddReferences(NetFramework.mscorlib, NetFramework.System, NetFramework.SystemCore, NetFramework.SystemRuntime, NetFramework.SystemValueTuple)
.AddSyntaxTrees(ParseSyntaxTree(code));
}

Expand Down
Loading