From 4b0b4ff46626405e88d6a4f101343c2f827eef28 Mon Sep 17 00:00:00 2001 From: elachlan <2433737+elachlan@users.noreply.github.com> Date: Thu, 21 Jul 2022 08:31:02 +1000 Subject: [PATCH 1/2] Fixes #608 --- src/Microsoft.Windows.CsWin32/SourceGenerator.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.Windows.CsWin32/SourceGenerator.cs b/src/Microsoft.Windows.CsWin32/SourceGenerator.cs index 95f5df2a..ac0d9ece 100644 --- a/src/Microsoft.Windows.CsWin32/SourceGenerator.cs +++ b/src/Microsoft.Windows.CsWin32/SourceGenerator.cs @@ -125,6 +125,7 @@ public class SourceGenerator : ISourceGenerator private const string NativeMethodsTxtAdditionalFileName = "NativeMethods.txt"; private const string NativeMethodsJsonAdditionalFileName = "NativeMethods.json"; + private static readonly char[] ZeroWhiteSpace = new char[] { '\uFEFF', '\u200B' }; /// public void Initialize(GeneratorInitializationContext context) @@ -201,7 +202,7 @@ public void Execute(GeneratorExecutionContext context) continue; } - name = name.Trim(); + name = name.Trim().Trim(ZeroWhiteSpace); var location = Location.Create(nativeMethodsTxtFile.Path, line.Span, nativeMethodsTxt.Lines.GetLinePositionSpan(line.Span)); try { From a0158da3dac88b1d478f468704ef4031ab84f4f9 Mon Sep 17 00:00:00 2001 From: elachlan <2433737+elachlan@users.noreply.github.com> Date: Thu, 21 Jul 2022 12:18:45 +1000 Subject: [PATCH 2/2] Add char description comments --- src/Microsoft.Windows.CsWin32/SourceGenerator.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.Windows.CsWin32/SourceGenerator.cs b/src/Microsoft.Windows.CsWin32/SourceGenerator.cs index ac0d9ece..249074e2 100644 --- a/src/Microsoft.Windows.CsWin32/SourceGenerator.cs +++ b/src/Microsoft.Windows.CsWin32/SourceGenerator.cs @@ -125,7 +125,11 @@ public class SourceGenerator : ISourceGenerator private const string NativeMethodsTxtAdditionalFileName = "NativeMethods.txt"; private const string NativeMethodsJsonAdditionalFileName = "NativeMethods.json"; - private static readonly char[] ZeroWhiteSpace = new char[] { '\uFEFF', '\u200B' }; + private static readonly char[] ZeroWhiteSpace = new char[] + { + '\uFEFF', // ZERO WIDTH NO-BREAK SPACE (U+FEFF) + '\u200B', // ZERO WIDTH SPACE (U+200B) + }; /// public void Initialize(GeneratorInitializationContext context)