Skip to content

Commit

Permalink
Trim Zero White Space (#609)
Browse files Browse the repository at this point in the history
* Fixes #608

* Add char description comments
  • Loading branch information
elachlan committed Jul 21, 2022
1 parent 2a93435 commit 26be795
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Microsoft.Windows.CsWin32/SourceGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +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', // ZERO WIDTH NO-BREAK SPACE (U+FEFF)
'\u200B', // ZERO WIDTH SPACE (U+200B)
};

/// <inheritdoc/>
public void Initialize(GeneratorInitializationContext context)
Expand Down Expand Up @@ -201,7 +206,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
{
Expand Down

0 comments on commit 26be795

Please sign in to comment.