[release/6.0] Support duplicated type names with src gen #58766
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport of #58448 to release/6.0
Addresses #57349 for the System.Text.Json generator
Customer Impact
Support an edge case where a given type (by full name) can exist in more than one location. Without this change, any duplicated Types are not generated (the non-wrapped API returns
nullwhen there are conflicts). This allows thepublicversion of a Type to be returned over theinternalversion of the Type, for example.The corresponding issue and code was provided by the Roslyn team. The code wraps the API that resolves a Type name to a Type in order to allow
publicto win overinternal, for example.Testing
A test was added that duplicates types by name. The test failed before the changes were made.
Risk
Low - the corresponding code was provided by Roslyn and was previously tested. In the future, new API(s) will likely be exposed by Roslyn to address this scenario more fully and then this code can be removed.