Skip to content

Source generator must always prepend all usings and namespace references with global:: #8170

@xperiandri

Description

@xperiandri

Current behavior

The source generator does not always prepend all usings and namespace references with `global::``

Expected behavior

The source generator does always prepend all usings and namespace references with `global::``

How to reproduce it (as minimally and precisely as possible)

Create any class in the namespace <SolutionName>.Windows.
After that, you won't be able to build the app because of the namespace issue in the code generated from App.xaml

Workaround

Do not use namespaces that contain Windows in their segment

Works on UWP/WinUI

Yes

Environment

Uno.UI / Uno.UI.WebAssembly / Uno.UI.Skia

NuGet package version(s)

4.2.0-dev.100

Affected platforms

iOS, Android, WebAssembly, macOS, Skia (WPF), Skia (GTK on Linux/macOS/Windows), Skia (Tizen)

IDE

Visual Studio 2022

IDE version

17.1 preview

Relevant plugins

No response

Anything else we need to know?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/code-generationCategorizes an issue or PR as relevant to code generationdifficulty/medium 🤔Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUIkind/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions