[release/8.0-staging] Return null instead of throwing in ServiceDescriptor.ImplementationInstance\Type\Factory if a keyed service #106841
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 #105776 to release/8.0-staging
Customer Impact
See issue #95789 and duplicate issue #99622. In 8.0, when supported for keyed services was added, 3 existing properties were changed to throw
InvalidOperationExceptionin cases where they were not expected to be called. However, this caused some backwards compatibility issues for various scenarios including tooling.Regression
The 3 affected properties before the keyed services feature was added in 8.0 did not throw; once the keyed services feature was added they can throw, by design, in cases where they were not expected to be called.
Testing
The tests verify the expected behavior of returning
nullinstead of throwing; existing tests were modified in 9.0 for the new behavior.Risk
Low, this changes 3 properties that were changed in 8.0 to throw an
InvalidOperationExceptionin unexpected cases; with this PR they returnnullinstead.