-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[release/8.0-staging] Use fully qualified names when referencing user types. (#94267) #94307
[release/8.0-staging] Use fully qualified names when referencing user types. (#94267) #94307
Conversation
Tagging subscribers to this area: @dotnet/area-extensions-configuration Issue DetailsBackport of #94267 to release/8.0 Customer ImpactAs implemented, the This PR updates the source generator to always use fully qualified names when referencing user declared types. TestingAdded regression testing covering the type name conflict scenario. RiskLow to moderate. Makes substantial changes to product code, replacing all type formatting from minimal to fully qualified names.
|
Should this target |
oops, @teo-tsirpanis is correct. This should be ported to |
I went ahead and changed the target branch of the PR. It should port cleanly as we haven't had churn there. edit: looks like we need to remove a couple commits. |
* Use fully qualified names when referencing user types. * Use ToUpperInvariant * Address feedback
757f066
to
a204e81
Compare
is it possible to check our various other source generators in the box for the same issue? |
STJ has been using fully qualified names since it shipped. Not sure what the case is with options validator or the logger cc @tarekgh |
Logging and options source generators use fully qualified names too. You may look at examples here: https://github.com/dotnet/runtime/blob/main/src/libraries/Microsoft.Extensions.Logging.Abstractions/tests/Microsoft.Extensions.Logging.Generators.Tests/Baselines/TestWithDefaultValues.generated.txt |
Yeah and the Regex one and the RequestDelegateGenerator do as well, but how to figure whether they're using |
@BrennanConroy what about the SignalR generators? |
It's not shipping. But if we have validation that can be added we'd be interested so we can add it when we do want to ship it. |
RDG uses FQN + |
Approved over mail. |
Backport of #94267 to release/8.0-staging
Customer Impact
As implemented, the
ConfigurationBinder
source generator employsusing
statements to import namespaces of user-defined types and references these types by name only. This can cause compiler errors in cases where there is ambiguity -- i.e. referencing types with equal names but in different namespaces. This is blocking partner teams when working with common scenaria, see #93498.This PR updates the source generator to always use fully qualified names when referencing user declared types.
Testing
Added regression testing covering the type name conflict scenario. Manually tested eshopOnContainers sample, and Azure.Data.Tables package as well.
Risk
Low to moderate. Makes substantial changes to product code, replacing all type formatting from minimal to fully qualified names.