Remove forced override of package contents

Fixes #1155
This commit is contained in:
Sam Harwell 2024-04-08 11:16:45 -05:00
Родитель 68ac704c81
Коммит b2d155f96e
2 изменённых файлов: 32 добавлений и 10 удалений

Просмотреть файл

@ -460,16 +460,6 @@ namespace Microsoft.CodeAnalysis.Testing
}
}
// Prefer assemblies from the reference assembly package to ones otherwise provided
if (ReferenceAssemblyPackage is not null)
{
var referenceAssemblies = new HashSet<string>(resolvedAssemblies.Where(resolved => resolved.StartsWith(referenceAssemblyInstalledPath!)));
// Suppression due to https://github.com/dotnet/roslyn/issues/44735
var referenceAssemblyNames = new HashSet<string>(referenceAssemblies.Select((Func<string, string>)Path.GetFileNameWithoutExtension!));
resolvedAssemblies.RemoveWhere(resolved => referenceAssemblyNames.Contains(Path.GetFileNameWithoutExtension(resolved)) && !referenceAssemblies.Contains(resolved));
}
// Add the facade assemblies
if (ReferenceAssemblyPackage is not null)
{

Просмотреть файл

@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
using Xunit;
@ -649,6 +650,37 @@ class TestClass {
}.RunAsync();
}
[Theory]
[InlineData("net462")]
[InlineData("net47")]
[InlineData("net471")]
[InlineData("net472")]
[InlineData("net48")]
#if !(NETCOREAPP1_1 || NET46)
[InlineData("net6.0")]
[InlineData("net7.0")]
[InlineData("net8.0")]
#endif
[InlineData("netstandard2.0")]
[InlineData("netstandard2.1")]
public async Task ResolveSystemCollectionsImmutable8(string targetFramework)
{
var testCode = @"
using System.Collections.Frozen;
class TestClass {
FrozenSet<int> TestMethod() => throw null;
}
";
await new CSharpTest()
{
TestCode = testCode,
ReferenceAssemblies = ReferenceAssembliesForTargetFramework(targetFramework)
.AddPackages(ImmutableArray.Create(new PackageIdentity("System.Collections.Immutable", "8.0.0"))),
}.RunAsync();
}
internal static ReferenceAssemblies ReferenceAssembliesForTargetFramework(string targetFramework)
{
return targetFramework switch