Skip to content
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

Remove temporary .NET 8 reference assemblies #7220

Merged
merged 1 commit into from
Mar 5, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ public async Task CA1823_CSharp_InlineArrayAttributeAsync()
{
await new VerifyCS.Test
{
ReferenceAssemblies = AdditionalMetadataReferences.Net80,
ReferenceAssemblies = ReferenceAssemblies.Net.Net80,
TestCode = @"
using System.Runtime.CompilerServices;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1080,33 +1080,12 @@ private static async Task VerifyCodeFixAsync(LanguageVersion languageVersion, st
{
await new VerifyCS.Test
{
ReferenceAssemblies = Net80,
ReferenceAssemblies = ReferenceAssemblies.Net.Net80,
LanguageVersion = languageVersion,
TestCode = source,
FixedCode = expected,
TestState = { OutputKind = topLevelStatements ? OutputKind.ConsoleApplication : null },
}.RunAsync();
}

// TEMP - need newer version of Microsoft.CodeAnalysis.Analyzer.Testing
// Replace with 'ReferenceAssemblies.Net.Net80'
private static readonly Lazy<ReferenceAssemblies> _lazyNet80 =
new(() =>
{
if (!NuGet.Frameworks.NuGetFramework.Parse("net8.0").IsPackageBased)
{
// The NuGet version provided at runtime does not recognize the 'net8.0' target framework
throw new NotSupportedException("The 'net8.0' target framework is not supported by this version of NuGet.");
}

return new ReferenceAssemblies(
"net8.0",
new PackageIdentity(
"Microsoft.NETCore.App.Ref",
"8.0.0-preview.7.23375.6"),
System.IO.Path.Combine("ref", "net8.0"));
});

public static ReferenceAssemblies Net80 => _lazyNet80.Value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ private async Task VerifyNet50CSharpAdditionalFileFixAsync(string source, string

private async Task VerifyNet80CSharpAdditionalFileFixAsync(string source, string? shippedApiText, string? oldUnshippedApiText, string newUnshippedApiText)
{
await VerifyAdditionalFileFixAsync(LanguageNames.CSharp, source, shippedApiText, oldUnshippedApiText, newUnshippedApiText, AdditionalMetadataReferences.Net80);
await VerifyAdditionalFileFixAsync(LanguageNames.CSharp, source, shippedApiText, oldUnshippedApiText, newUnshippedApiText, ReferenceAssemblies.Net.Net80);
}

private async Task VerifyAdditionalFileFixAsync(string language, string source, string? shippedApiText, string? oldUnshippedApiText, string newUnshippedApiText,
Expand Down Expand Up @@ -3269,7 +3269,7 @@ public async Task TestExperimentalApiWithInvalidArgumentAsync(string invalidArgu

var test = new CSharpCodeFixTest<DeclarePublicApiAnalyzer, DeclarePublicApiFix, XUnitVerifier>()
{
ReferenceAssemblies = AdditionalMetadataReferences.Net80,
ReferenceAssemblies = ReferenceAssemblies.Net.Net80,
CompilerDiagnostics = CompilerDiagnostics.None,
TestState =
{
Expand Down
8 changes: 0 additions & 8 deletions src/Test.Utilities/AdditionalMetadataReferences.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information.

using System.Collections.Immutable;
using System.IO;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Testing;
Expand All @@ -10,13 +9,6 @@ namespace Test.Utilities
{
public static class AdditionalMetadataReferences
{
public static ReferenceAssemblies Net80 { get; } = new ReferenceAssemblies(
"net8.0",
new PackageIdentity(
"Microsoft.NETCore.App.Ref",
"8.0.0-preview.6.23329.7"),
Path.Combine("ref", "net8.0"));

public static ReferenceAssemblies Default { get; } = CreateDefaultReferenceAssemblies();

public static ReferenceAssemblies DefaultWithoutRoslynSymbols { get; } = ReferenceAssemblies.Default
Expand Down