-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ConfigurationBinder source generator build fails with CS9035 if option class have Property with requried #95006
Comments
Tagging subscribers to this area: @dotnet/area-extensions-configuration Issue DetailsDescriptionConfigurationBinder source generator generates code that doesn't compile when using recodrs with requried properties as option Property Reproduction Stepsbuild this code using System.Reflection; internal class Program
} internal sealed record MyOptionA internal sealed record MyOptionB Expected behaviorCode should compiles Actual behaviorbuild files with error CS9035 Regression?No response Known WorkaroundsNo response ConfigurationNo response Other informationNo response
|
Any update on this? |
Right now the source generator doesn't use object initializers at all, nor will it bind to |
Are there plans to do some work in this area for .NET 10? Anything I can do to help? |
Description
ConfigurationBinder source generator generates code that doesn't compile when using recodrs with requried properties as option Property
Reproduction Steps
build this code
Expected behavior
Code should compiles
Actual behavior
build files with error CS9035
BinGeneratorRepro\Microsoft.Extensions.Configuration.Binder.SourceGeneration\Microsoft.Extensions.Configuration.Binder.SourceGeneration.ConfigurationBindingGenerator\BindingExtensions.g.cs(106,31,106,40): error CS9035: Required member 'MyOptionB.MyParamB' must be set in the object initializer or attribute constructor.
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
The text was updated successfully, but these errors were encountered: