unoplatform / uno

Open-source platform for building cross-platform native Mobile, Web, Desktop and Embedded apps quickly. Create rich, C#/XAML, single-codebase apps from any IDE. Hot Reload included! 90m+ NuGet Downloads!!
https://platform.uno
Apache License 2.0
8.9k stars 720 forks source link

[WASM] `HotReloadWorkaround` breaks build when global using defines alias or uses static class #18603

Open xperiandri opened 7 hours ago

xperiandri commented 7 hours ago

Current behavior

Generated code hides classes with generated namespaces

Expected behavior

When Static="true" or Alias="SR" specified no namespace generated

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

  1. Install OpenIddict.Abstractions NuGet package
  2. Add the following lines to csproj
    <Using Include="OpenIddict.Abstractions" />
    <Using Include="OpenIddict.Abstractions.OpenIddictConstants" Static="true" />
    <Using Include="OpenIddict.Abstractions.OpenIddictResources" Alias="SR" />
  3. Add code that accesses SR aliased type
  4. See build error on WASM

Workaround

Disable HotReloadWorkaround 😄

Works on UWP/WinUI

Yes

Environment

Uno.WinUI / Uno.WinUI.WebAssembly / Uno.WinUI.Skia

NuGet package version(s)

No response

Affected platforms

WebAssembly

IDE

Visual Studio 2022

IDE version

17.12

Relevant plugins

No response

Anything else we need to know?

No response

xperiandri commented 7 hours ago

@jeromelaban the correct line must be <_UsingsDedup Include="%(Using.Identity)" KeepDuplicates="false" Condition="'%(Using.Static)' == '' AND '%(Using.Alias)' == ''" />