-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Configuration binder generator generates source with compilation errors #92453
Comments
Tagging subscribers to this area: @dotnet/area-extensions-configuration Issue DetailsDescriptionEnabling ASP.Net configuration binding source generator produces uncompilable source.
Compiler errors produced:
Reproduction StepsSimple webapi project repro repository at https://github.com/tonesandtones/ConfigBinderGeneratorRepro.
Expected behaviorProject should compile. Actual behaviorProject does not compile. Produces the following compilation errors.
Regression?Unknown, I haven't tried this project with previous releases. Known WorkaroundsPartial workaround for missing usings is to add the missing using to global implicit usings.
It's also possible to generate the source once, persist to disk, manually modify the source to add the missing comma, and disable the generator. This is obviously a bad idea though as future changes will not regenerate the source which will break the source-generated interceptor as line numbers may not match any more. Configuration
Other informationNo response
|
This looks like a duplicate of #92273. Can you try the RC2 package as described in the linked issue to see if that resolves it for you? |
Missing comma possibly fixed by #91180? Missing using possibly fixed by #91565? |
Fantastic, yes it's fixed in RC2 package ref |
Description
Enabling ASP.Net configuration binding source generator produces uncompilable source.
Compiler errors produced:
Microsoft.Extensions.Options
Microsoft.Extensions.Options
to implicit global usings in the csproj.BindingExtensions.g.cs
, missing comma near the end of line.Reproduction Steps
Simple webapi project repro repository at https://github.com/tonesandtones/ConfigBinderGeneratorRepro.
dotnet new web --name ConfigBinderGeneratorRepro --use-program-main
<EnableConfigurationBindingGenerator>true</EnableConfigurationBindingGenerator>
ItemGroup
to demonstrate the workaround that adds the missing using to the implicit global usings.Expected behavior
Project should compile.
Actual behavior
Project does not compile. Produces the following compilation errors.
Regression?
Unknown, I haven't tried this project with previous releases.
Known Workarounds
Partial workaround for missing usings is to add the missing using to global implicit usings.
It's also possible to generate the source once, persist to disk, manually modify the source to add the missing comma, and disable the generator. This is obviously a bad idea though as future changes will not regenerate the source which will break the source-generated interceptor as line numbers may not match any more.
Configuration
Other information
No response
The text was updated successfully, but these errors were encountered: