Skip to content

Commit

Permalink
Update WinRT ref assembly used by tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AArnott committed Mar 17, 2023
1 parent 357a566 commit c7449af
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/Microsoft.Windows.CsWin32.Tests/GeneratorTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,9 @@ protected async Task<CSharpCompilation> CreateCompilationAsync(ReferenceAssembli
ImmutableArray<MetadataReference> metadataReferences = await references.ResolveAsync(LanguageNames.CSharp, default);

// Workaround for https://github.com/dotnet/roslyn-sdk/issues/699
const string winRTPackageId = "Microsoft.Windows.SDK.Contracts";
metadataReferences = metadataReferences.AddRange(
Directory.GetFiles(Path.Combine(Path.GetTempPath(), "test-packages", "Microsoft.Windows.SDK.Contracts.10.0.19041.1", "ref", "netstandard2.0"), "*.winmd").Select(p => MetadataReference.CreateFromFile(p)));
Directory.GetFiles(Path.Combine(Path.GetTempPath(), "test-packages", $"{winRTPackageId}.{references.Packages.Single(id => string.Equals(id.Id, winRTPackageId, StringComparison.OrdinalIgnoreCase)).Version}", "ref", "netstandard2.0"), "*.winmd").Select(p => MetadataReference.CreateFromFile(p)));

// CONSIDER: How can I pass in the source generator itself, with AdditionalFiles, so I'm exercising that code too?
var compilation = CSharpCompilation.Create(
Expand Down Expand Up @@ -355,7 +356,7 @@ protected static class MyReferenceAssemblies
{
#pragma warning disable SA1202 // Elements should be ordered by access - because field initializer depend on each other
private static readonly ImmutableArray<PackageIdentity> AdditionalLegacyPackages = ImmutableArray.Create(
new PackageIdentity("Microsoft.Windows.SDK.Contracts", "10.0.19041.1"));
new PackageIdentity("Microsoft.Windows.SDK.Contracts", "10.0.22621.2"));

private static readonly ImmutableArray<PackageIdentity> AdditionalModernPackages = AdditionalLegacyPackages.AddRange(ImmutableArray.Create(
new PackageIdentity("System.Runtime.CompilerServices.Unsafe", "6.0.0"),
Expand Down
1 change: 1 addition & 0 deletions test/Microsoft.Windows.CsWin32.Tests/GeneratorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ public void SupportedOSPlatform_AppearsOnFriendlyOverloads()
"PZZWSTR",
"PCZZSTR",
"PCZZWSTR",
"RoCreatePropertySetSerializer", // References a WinRT API
"LocalLock", // returns HLOCAL, which requires special release support
"LoadLibraryEx", // method with a reserved parameter
"IEnumNetCfgComponent", // interface with a method containing an `[Reserved] out` parameter (bonkers, I know).
Expand Down

0 comments on commit c7449af

Please sign in to comment.