From cea5eaba6af040b99da6f839f713e77ceef6d442 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 17 Sep 2021 19:40:28 -0600 Subject: [PATCH] Suppress CS0436 in generated files --- src/Microsoft.Windows.CsWin32/Generator.cs | 1 + .../GeneratorTests.cs | 42 +++++++++---------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/Microsoft.Windows.CsWin32/Generator.cs b/src/Microsoft.Windows.CsWin32/Generator.cs index ba31803b..742eda84 100644 --- a/src/Microsoft.Windows.CsWin32/Generator.cs +++ b/src/Microsoft.Windows.CsWin32/Generator.cs @@ -267,6 +267,7 @@ public class Generator : IDisposable "CS1570", // XML comment has badly formed XML "CS1584", // C# bug: https://github.com/microsoft/CsWin32/issues/24 "CS1658", // C# bug: https://github.com/microsoft/CsWin32/issues/24 + "CS0436", // conflicts with the imported type (InternalsVisibleTo between two projects that both use CsWin32) }; private static readonly AttributeSyntax OptionalAttributeSyntax = Attribute(IdentifierName("Optional")).WithArgumentList(null); diff --git a/test/Microsoft.Windows.CsWin32.Tests/GeneratorTests.cs b/test/Microsoft.Windows.CsWin32.Tests/GeneratorTests.cs index 970d143b..b0143e73 100644 --- a/test/Microsoft.Windows.CsWin32.Tests/GeneratorTests.cs +++ b/test/Microsoft.Windows.CsWin32.Tests/GeneratorTests.cs @@ -1038,7 +1038,7 @@ public async Task TestSimpleStructure() // // ------------------------------------------------------------------------------ -#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658 +#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436 namespace Windows.Win32 { using global::System; @@ -1099,7 +1099,7 @@ public async Task TestSimpleEnum() // // ------------------------------------------------------------------------------ -#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658 +#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436 namespace Windows.Win32 { using global::System; @@ -1164,7 +1164,7 @@ public async Task TestSimpleEnumWithoutDocs() // // ------------------------------------------------------------------------------ -#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658 +#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436 namespace Windows.Win32 { using global::System; @@ -1219,7 +1219,7 @@ public async Task TestFlagsEnum() // // ------------------------------------------------------------------------------ -#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658 +#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436 namespace Windows.Win32 { using global::System; @@ -1295,7 +1295,7 @@ public async Task TestSimpleDelegate() // // ------------------------------------------------------------------------------ -#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658 +#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436 namespace Windows.Win32 { using global::System; @@ -1333,7 +1333,7 @@ public static implicit operator bool(BOOL value) // // ------------------------------------------------------------------------------ -#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658 +#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436 namespace Windows.Win32 { using global::System; @@ -1358,7 +1358,7 @@ namespace UI.WindowsAndMessaging // // ------------------------------------------------------------------------------ -#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658 +#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436 namespace Windows.Win32 { using global::System; @@ -1398,7 +1398,7 @@ internal readonly partial struct HWND // // ------------------------------------------------------------------------------ -#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658 +#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436 namespace Windows.Win32 { using global::System; @@ -1461,7 +1461,7 @@ public async Task TestSimpleMethod() // // ------------------------------------------------------------------------------ -#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658 +#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436 namespace Windows.Win32 { using global::System; @@ -1503,7 +1503,7 @@ internal readonly partial struct HDC // // ------------------------------------------------------------------------------ -#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658 +#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436 namespace Windows.Win32 { using global::System; @@ -1543,7 +1543,7 @@ internal readonly partial struct HWND // // ------------------------------------------------------------------------------ -#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658 +#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436 namespace Windows.Win32 { using global::System; @@ -1605,7 +1605,7 @@ public async Task TestMethodWithOverloads() // // ------------------------------------------------------------------------------ -#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658 +#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436 namespace Windows.Win32 { using global::System; @@ -1643,7 +1643,7 @@ public static implicit operator bool(BOOL value) // // ------------------------------------------------------------------------------ -#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658 +#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436 namespace Windows.Win32 { using global::System; @@ -1696,7 +1696,7 @@ internal enum FILE_ACCESS_FLAGS : uint // // ------------------------------------------------------------------------------ -#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658 +#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436 namespace Windows.Win32 { using global::System; @@ -1727,7 +1727,7 @@ internal enum FILE_CREATION_DISPOSITION : uint // // ------------------------------------------------------------------------------ -#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658 +#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436 namespace Windows.Win32 { using global::System; @@ -1796,7 +1796,7 @@ internal enum FILE_FLAGS_AND_ATTRIBUTES : uint // // ------------------------------------------------------------------------------ -#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658 +#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436 namespace Windows.Win32 { using global::System; @@ -1827,7 +1827,7 @@ internal enum FILE_SHARE_MODE : uint // // ------------------------------------------------------------------------------ -#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658 +#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436 namespace Windows.Win32 { using global::System; @@ -1869,7 +1869,7 @@ internal readonly partial struct HANDLE // // ------------------------------------------------------------------------------ -#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658 +#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436 namespace Windows.Win32 { using global::System; @@ -1947,7 +1947,7 @@ internal int Length // // ------------------------------------------------------------------------------ -#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658 +#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436 namespace Windows.Win32 { using global::System; @@ -2053,7 +2053,7 @@ internal static unsafe Microsoft.Win32.SafeHandles.SafeFileHandle CreateFile(str // // ------------------------------------------------------------------------------ -#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658 +#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436 namespace Windows.Win32 { using global::System; @@ -2110,7 +2110,7 @@ internal int Length // // ------------------------------------------------------------------------------ -#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658 +#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436 namespace Windows.Win32 { using global::System;