diff --git a/Directory.Packages.props b/Directory.Packages.props index f3e24b8e..6e00d043 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,7 +4,7 @@ true true - 46.0.5-preview + 49.0.21-preview 0.1.12-alpha diff --git a/src/Microsoft.Windows.CsWin32/Generator.Invariants.cs b/src/Microsoft.Windows.CsWin32/Generator.Invariants.cs index 5c9e3282..000ef045 100644 --- a/src/Microsoft.Windows.CsWin32/Generator.Invariants.cs +++ b/src/Microsoft.Windows.CsWin32/Generator.Invariants.cs @@ -5,7 +5,7 @@ namespace Microsoft.Windows.CsWin32; public partial class Generator { - internal const string InteropDecorationNamespace = "Windows.Win32.Interop"; + internal const string InteropDecorationNamespace = "Windows.Win32.Foundation.Metadata"; internal const string NativeArrayInfoAttribute = "NativeArrayInfoAttribute"; internal const string RAIIFreeAttribute = "RAIIFreeAttribute"; internal const string DoNotReleaseAttribute = "DoNotReleaseAttribute"; diff --git a/src/Microsoft.Windows.CsWin32/Generator.cs b/src/Microsoft.Windows.CsWin32/Generator.cs index 72de9f64..b82468df 100644 --- a/src/Microsoft.Windows.CsWin32/Generator.cs +++ b/src/Microsoft.Windows.CsWin32/Generator.cs @@ -456,6 +456,12 @@ public void GenerateAllInteropTypes(CancellationToken cancellationToken) continue; } + if (this.Reader.StringComparer.Equals(typeDef.Namespace, InteropDecorationNamespace)) + { + // Ignore the attributes that describe the metadata. + continue; + } + if (this.IsCompatibleWithPlatform(typeDef.GetCustomAttributes())) { try diff --git a/src/Microsoft.Windows.CsWin32/MetadataIndex.cs b/src/Microsoft.Windows.CsWin32/MetadataIndex.cs index 499fe208..bd7ed257 100644 --- a/src/Microsoft.Windows.CsWin32/MetadataIndex.cs +++ b/src/Microsoft.Windows.CsWin32/MetadataIndex.cs @@ -94,7 +94,7 @@ private MetadataIndex(string metadataPath, Platform? platform) var trh = (TypeReferenceHandle)memberReference.Parent; TypeReference tr = mr.GetTypeReference(trh); if (mr.StringComparer.Equals(tr.Name, "SupportedArchitectureAttribute") && - mr.StringComparer.Equals(tr.Namespace, "Windows.Win32.Interop")) + mr.StringComparer.Equals(tr.Namespace, Generator.InteropDecorationNamespace)) { this.SupportedArchitectureAttributeCtor = memberRefHandle; break; diff --git a/test/GenerationSandbox.Tests/GeneratedForm.cs b/test/GenerationSandbox.Tests/GeneratedForm.cs index 1bd8ec97..3b2a4851 100644 --- a/test/GenerationSandbox.Tests/GeneratedForm.cs +++ b/test/GenerationSandbox.Tests/GeneratedForm.cs @@ -35,7 +35,7 @@ private static void WPARAM_From_NInt() private static void FARPROC_InSignatureChangedToIntPtr() { - FARPROC p = PInvoke.GetProcAddress(default(HINSTANCE), default(PCSTR)); + FARPROC p = PInvoke.GetProcAddress(default(HMODULE), default(PCSTR)); p = PInvoke.GetProcAddress(default(SafeHandle), null); } diff --git a/test/Microsoft.Windows.CsWin32.Tests/HandleTests.cs b/test/Microsoft.Windows.CsWin32.Tests/HandleTests.cs index 83de7b5d..95c20bfa 100644 --- a/test/Microsoft.Windows.CsWin32.Tests/HandleTests.cs +++ b/test/Microsoft.Windows.CsWin32.Tests/HandleTests.cs @@ -111,7 +111,7 @@ public void HandleStructsHaveIsNullProperty(string handleName) [Theory] [InlineData("HANDLE")] [InlineData("HGDIOBJ")] - [InlineData("HINSTANCE")] + [InlineData("HMODULE")] public void HandleStructsHaveStaticNullMember(string handleName) { // A null HGDIOBJ has a specific meaning beyond just the concept of an invalid handle: diff --git a/test/SpellChecker/Program.cs b/test/SpellChecker/Program.cs index 7b464885..d024c816 100644 --- a/test/SpellChecker/Program.cs +++ b/test/SpellChecker/Program.cs @@ -29,7 +29,7 @@ Span suggestionResult = new PWSTR[1]; while (true) { - if (errors.Next() is not ISpellingError error) + if (errors.Next(out ISpellingError error).ThrowOnFailure() == HRESULT.S_FALSE) { break; } diff --git a/test/WinRTInteropTest/NativeMethods.txt b/test/WinRTInteropTest/NativeMethods.txt index f1abe67d..f35f5f0a 100644 --- a/test/WinRTInteropTest/NativeMethods.txt +++ b/test/WinRTInteropTest/NativeMethods.txt @@ -10,8 +10,8 @@ EndPaint GetMessage GetModuleHandle HDC -HINSTANCE HMENU +HMODULE HWND ICompositorDesktopInterop IDC_ARROW