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

Fix generation failure when emitting members as various C# keywords #779

Merged
merged 1 commit into from
Nov 15, 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
25 changes: 14 additions & 11 deletions src/Microsoft.Windows.CsWin32/Generator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -307,22 +307,25 @@ public class Generator : IDisposable

private static readonly HashSet<string> CSharpKeywords = new HashSet<string>(StringComparer.Ordinal)
{
"object",
"as",
"base",
"checked",
"decimal",
"event",
"in",
"is",
"internal",
"lock",
"object",
"out",
"override",
"public",
"params",
"private",
"protected",
"internal",
"virtual",
"string",
"base",
"public",
"ref",
"in",
"out",
"decimal",
"as",
"params",
"string",
"virtual",
};

private static readonly HashSet<string> ObjectMembers = new HashSet<string>(StringComparer.Ordinal)
Expand Down
2 changes: 2 additions & 0 deletions test/Microsoft.Windows.CsWin32.Tests/GeneratorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,8 @@ public void COMInterfaceWithSupportedOSPlatform(bool net60, bool allowMarshaling
"PZZWSTR",
"PCZZSTR",
"PCZZWSTR",
"IRealTimeStylusSynchronization", // uses the `lock` C# keyword.
"IHTMLInputElement", // has a field named `checked`, a C# keyword.
"NCryptImportKey", // friendly overload takes SafeHandle backed by a UIntPtr instead of IntPtr
"IUIAutomation", // non-preservesig retval COM method with a array size index parameter
"IHTMLWindow2", // contains properties named with C# reserved keywords
Expand Down