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

IConfigBuilder.Section doesn't work with configurationSection param, works with configSection

Open ttustonic opened this issue 8 months ago • 2 comments

Current behavior

Setting configurationSection parameter doesn't work, configuration is not read from config file when the config section doesn't match the class name Setting configSection works

Expected behavior

Both configurationSection and configSection should work the same.

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

Attached is a new project from the wizard. In the project there's a new config class, AppTest. public record AppTest { public string? InfoTitle { get; init; } }

In the config file there's a section "AppTestTEST": { "InfoTitle": "AppInfo title" } in UseConfiguration there's a line: .Section<AppTest>(configurationSection: "AppTestTEST") which doesn't work (value of InfoTitle is null), but .Section<AppTest>(configSection: (hbc) => hbc.Configuration.GetSection("AppTestTEST")) works as expected.

MainViewModel has an additional parameter, IOptions<AppTest> appTest, and new property TestTitle which is bound to the Textbox in the MainPage.xaml

Environment

Nuget Package (s): default packages from the Uno Platform App wizard Package Version(s):

Affected platform(s):

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

Visual Studio:

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

Relevant plugins:

  • [ ] Resharper (version: )

Anything else we need to know?

UnoApp1.zip

ttustonic avatar Jun 07 '24 23:06 ttustonic