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

Suppress CS8981 in generated code #574

Merged
merged 2 commits into from
Jun 2, 2022
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
1 change: 1 addition & 0 deletions src/Microsoft.Windows.CsWin32/Generator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ public class Generator : IDisposable
"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)
"CS8981", // The type name only contains lower-cased ascii characters
};

private static readonly SyntaxTriviaList FileHeader = ParseLeadingTrivia(AutoGeneratedHeader).Add(
Expand Down
58 changes: 29 additions & 29 deletions test/Microsoft.Windows.CsWin32.Tests/GeneratorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class GeneratorTests : IDisposable, IAsyncLifetime
// </auto-generated>
// ------------------------------------------------------------------------------

#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436
#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981
[assembly: global::System.Reflection.AssemblyMetadata(""Microsoft.Windows.CsWin32"",""{ThisAssembly.AssemblyInformationalVersion}"")]
".Replace("\r\n", "\n");

Expand Down Expand Up @@ -1406,7 +1406,7 @@ public void ProjectReferenceBetweenTwoGeneratingProjects(bool internalsVisibleTo
this.AssertNoDiagnostics();
}

[Fact]
[Fact, Trait("Verbatim", "true")]
public async Task TestSimpleStructure()
{
await new VerifyTest
Expand All @@ -1433,7 +1433,7 @@ public async Task TestSimpleStructure()
// </auto-generated>
// ------------------------------------------------------------------------------

#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436
#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981
namespace Windows.Win32
{
using global::System;
Expand Down Expand Up @@ -1468,7 +1468,7 @@ public static unsafe implicit operator bool(BOOL value)
}.RunAsync();
}

[Fact]
[Fact, Trait("Verbatim", "true")]
public async Task TestSimpleEnum()
{
await new VerifyTest
Expand Down Expand Up @@ -1496,7 +1496,7 @@ public async Task TestSimpleEnum()
// </auto-generated>
// ------------------------------------------------------------------------------

#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436
#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981
namespace Windows.Win32
{
using global::System;
Expand Down Expand Up @@ -1534,7 +1534,7 @@ internal enum DISPLAYCONFIG_SCANLINE_ORDERING
}.RunAsync();
}

[Fact]
[Fact, Trait("Verbatim", "true")]
public async Task TestSimpleEnumWithoutDocs()
{
await new VerifyTest
Expand Down Expand Up @@ -1562,7 +1562,7 @@ public async Task TestSimpleEnumWithoutDocs()
// </auto-generated>
// ------------------------------------------------------------------------------

#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436
#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981
namespace Windows.Win32
{
using global::System;
Expand Down Expand Up @@ -1590,7 +1590,7 @@ internal enum DISPLAYCONFIG_SCANLINE_ORDERING
}.RunAsync();
}

[Fact]
[Fact, Trait("Verbatim", "true")]
public async Task TestFlagsEnum()
{
await new VerifyTest
Expand Down Expand Up @@ -1618,7 +1618,7 @@ public async Task TestFlagsEnum()
// </auto-generated>
// ------------------------------------------------------------------------------

#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436
#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981
namespace Windows.Win32
{
using global::System;
Expand Down Expand Up @@ -1667,7 +1667,7 @@ internal enum FILE_ACCESS_FLAGS : uint
}.RunAsync();
}

[Fact]
[Fact, Trait("Verbatim", "true")]
public async Task TestSimpleDelegate()
{
await new VerifyTest
Expand All @@ -1694,7 +1694,7 @@ public async Task TestSimpleDelegate()
// </auto-generated>
// ------------------------------------------------------------------------------

#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436
#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981
namespace Windows.Win32
{
using global::System;
Expand Down Expand Up @@ -1733,7 +1733,7 @@ public static unsafe implicit operator bool(BOOL value)
// </auto-generated>
// ------------------------------------------------------------------------------

#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436
#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981
namespace Windows.Win32
{
using global::System;
Expand All @@ -1758,7 +1758,7 @@ namespace UI.WindowsAndMessaging
// </auto-generated>
// ------------------------------------------------------------------------------

#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436
#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981
namespace Windows.Win32
{
using global::System;
Expand Down Expand Up @@ -1798,7 +1798,7 @@ internal readonly partial struct HWND
// </auto-generated>
// ------------------------------------------------------------------------------

#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436
#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981
namespace Windows.Win32
{
using global::System;
Expand Down Expand Up @@ -1834,7 +1834,7 @@ internal readonly partial struct LPARAM
}.RunAsync();
}

[Fact]
[Fact, Trait("Verbatim", "true")]
public async Task TestSimpleMethod()
{
await new VerifyTest
Expand Down Expand Up @@ -1862,7 +1862,7 @@ public async Task TestSimpleMethod()
// </auto-generated>
// ------------------------------------------------------------------------------

#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436
#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981
namespace Windows.Win32
{
using global::System;
Expand Down Expand Up @@ -1904,7 +1904,7 @@ internal readonly partial struct HDC
// </auto-generated>
// ------------------------------------------------------------------------------

#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436
#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981
namespace Windows.Win32
{
using global::System;
Expand Down Expand Up @@ -1944,7 +1944,7 @@ internal readonly partial struct HWND
// </auto-generated>
// ------------------------------------------------------------------------------

#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436
#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981
namespace Windows.Win32
{
using global::System;
Expand Down Expand Up @@ -1979,7 +1979,7 @@ internal static partial class PInvoke
}.RunAsync();
}

[Fact]
[Fact, Trait("Verbatim", "true")]
public async Task TestMethodWithOverloads()
{
await new VerifyTest
Expand All @@ -2006,7 +2006,7 @@ public async Task TestMethodWithOverloads()
// </auto-generated>
// ------------------------------------------------------------------------------

#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436
#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981
namespace Windows.Win32
{
using global::System;
Expand Down Expand Up @@ -2045,7 +2045,7 @@ public static unsafe implicit operator bool(BOOL value)
// </auto-generated>
// ------------------------------------------------------------------------------

#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436
#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981
namespace Windows.Win32
{
using global::System;
Expand Down Expand Up @@ -2098,7 +2098,7 @@ internal enum FILE_ACCESS_FLAGS : uint
// </auto-generated>
// ------------------------------------------------------------------------------

#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436
#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981
namespace Windows.Win32
{
using global::System;
Expand Down Expand Up @@ -2129,7 +2129,7 @@ internal enum FILE_CREATION_DISPOSITION : uint
// </auto-generated>
// ------------------------------------------------------------------------------

#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436
#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981
namespace Windows.Win32
{
using global::System;
Expand Down Expand Up @@ -2201,7 +2201,7 @@ internal enum FILE_FLAGS_AND_ATTRIBUTES : uint
// </auto-generated>
// ------------------------------------------------------------------------------

#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436
#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981
namespace Windows.Win32
{
using global::System;
Expand Down Expand Up @@ -2232,7 +2232,7 @@ internal enum FILE_SHARE_MODE : uint
// </auto-generated>
// ------------------------------------------------------------------------------

#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436
#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981
namespace Windows.Win32
{
using global::System;
Expand Down Expand Up @@ -2274,7 +2274,7 @@ internal readonly partial struct HANDLE
// </auto-generated>
// ------------------------------------------------------------------------------

#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436
#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981
namespace Windows.Win32
{
using global::System;
Expand Down Expand Up @@ -2351,7 +2351,7 @@ internal int Length
// </auto-generated>
// ------------------------------------------------------------------------------

#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436
#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981
namespace Windows.Win32
{
using global::System;
Expand Down Expand Up @@ -2457,7 +2457,7 @@ internal static unsafe Microsoft.Win32.SafeHandles.SafeFileHandle CreateFile(str
// </auto-generated>
// ------------------------------------------------------------------------------

#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436
#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981
namespace Windows.Win32
{
using global::System;
Expand Down Expand Up @@ -2517,7 +2517,7 @@ internal int Length
// </auto-generated>
// ------------------------------------------------------------------------------

#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436
#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981
namespace Windows.Win32
{
using global::System;
Expand Down