unoplatform / uno

Build Mobile, Desktop and WebAssembly apps with C# and XAML. Today. Open source and professionally supported.
https://platform.uno
Apache License 2.0
8.61k stars 694 forks source link

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

Open xperiandri opened 2 years ago

xperiandri commented 2 years ago

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

xperiandri commented 1 year ago

@jeromelaban can anyone point out where this happens and what tests to execute?

jeromelaban commented 12 months ago

@xperiandri this would be in https://github.com/unoplatform/uno/tree/master/src/SourceGenerators/Uno.UI.SourceGenerators.netcore.Tests, as we're already doing some testing there for these scenarios.