Closed bartkemps closed 8 months ago
Tagging subscribers to this area: @dotnet/area-extensions-options See info in area-owners.md if you want to be subscribed.
Author: | bartkemps |
---|---|
Assignees: | - |
Labels: | `area-Extensions-Options` |
Milestone: | - |
This may be the same issue as this one: https://github.com/dotnet/runtime/issues/83803
Yes this is a duplicate of https://github.com/dotnet/runtime/issues/83803. The work around is not using record for now.
Description
I'm using records for my configuration / option classes. This worked fine until I decided to add an array: now the content of the array is doubled. I'm guessing array members are added in the constructer and later again though reflection.
Reproduction Steps
In a .net 8 web api application (at least, that's what I'm using) add an options record:
Add appsetings.json
Add Program.cs:
NOTE: this does not work either because an empty constructor is expected. This should be fixed too.
Expected behavior
The value of
myOptions.Bar
should bestring[] {"Fizz", "Buzz"}
Actual behavior
The value of
myOptions.Bar
isstring[] {"Fizz", "Buzz", "Fizz", "Buzz"}
Regression?
No response
Known Workarounds
Configuration
No response
Other information
No response