uno.extensions icon indicating copy to clipboard operation
uno.extensions copied to clipboard

[MVUX] Model with no namespace set causes FeedsGenerator error

Open nickrandolph opened this issue 1 year ago • 0 comments

Current behavior

Since namespaces are not mandatory, you can create a model in the global namespace eg

public partial record MainModel():

Unfortunately this causes a FeedsGenerator

...Uno.Extensions.Reactive.Generator\Uno.Extensions.Reactive.Generator.FeedsGenerator\MainModel.g.cs(15,68,15,85): error CS0400: The type or namespace name 'BindableMainModel' could not be found in the global namespace (are you missing an assembly reference?)

This seems to be because in the ViewModelMappings file we end up with:

public static readonly global::System.Collections.Generic.IDictionary<global::System.Type, global::System.Type> ViewModelMappings = new global::System.Collections.Generic.Dictionary<global::System.Type, global::System.Type>
		{
			{ typeof(MainModel), typeof(global::BindableMainModel) },
			{ typeof(TubePlayerWithAuth.Presentation.LoginModel), typeof(global::TubePlayerWithAuth.Presentation.BindableLoginModel) },
			{ typeof(TubePlayerWithAuth.Presentation.SecondModel), typeof(global::TubePlayerWithAuth.Presentation.BindableSecondModel) },
		};

But BindableMainModel isn't found in the global namespace (hence the error!)

Expected behavior

No error, or a meaningful warning

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

Environment

Nuget Package (s):

Package Version(s):

Affected platform(s):

  • [ ] iOS
  • [ ] macOS (AppKit)
  • [ ] Mac Catalyst
  • [ ] Android
  • [ ] WebAssembly
  • [ ] Windows
  • [ ] Skia (WPF)
  • [ ] Skia (GTK on Linux/macOS/Windows)
  • [ ] Skia (Linux Framebuffer)
  • [ ] Build tasks

Visual Studio:

  • [ ] 2019 (version: )
  • [ ] 2022 (version: )
  • [ ] Visual Studio Code (version: )
  • [ ] Rider Windows (version: )
  • [ ] Rider macOS (version: )

Relevant plugins:

  • [ ] Resharper (version: )

Anything else we need to know?

nickrandolph avatar Mar 21 '24 08:03 nickrandolph