Skip to content

Commit

Permalink
Add global:: in front of all using directives
Browse files Browse the repository at this point in the history
This addresses one problem with WinUI 3 projects consuming the generated source, as tracked by #59.
  • Loading branch information
AArnott committed Jan 30, 2021
1 parent f9c10a3 commit 0d0f5e3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Microsoft.Windows.CsWin32/Generator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -625,9 +625,9 @@ public IReadOnlyDictionary<string, CompilationUnitSyntax> GetCompilationUnits(Ca
var compilationUnit = CompilationUnit()
.AddMembers(
kv.Value.AddUsings(
UsingDirective(IdentifierName(nameof(System))),
UsingDirective(IdentifierName(nameof(System) + "." + nameof(System.Diagnostics))),
UsingDirective(ParseName(SystemRuntimeInteropServices))))
UsingDirective(AliasQualifiedName(IdentifierName(Token(SyntaxKind.GlobalKeyword)), IdentifierName(nameof(System)))),
UsingDirective(AliasQualifiedName(IdentifierName(Token(SyntaxKind.GlobalKeyword)), IdentifierName(nameof(System) + "." + nameof(System.Diagnostics)))),
UsingDirective(ParseName("global::" + SystemRuntimeInteropServices))))
.WithLeadingTrivia(ParseLeadingTrivia(AutoGeneratedHeader).Add(
Trivia(PragmaWarningDirectiveTrivia(Token(SyntaxKind.DisableKeyword), true).AddErrorCodes(WarningsToSuppressInGeneratedCode.Select(code => IdentifierName(code)).ToArray()))))
.NormalizeWhitespace();
Expand Down

0 comments on commit 0d0f5e3

Please sign in to comment.