[release/8.0] Enable output compilation validation in binder gen unit tests #91602
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 #91565 to release/8.0
Customer Impact
Fixes an RC-2 regression introduced in #91359, where any compilation that has binding
IServiceCollection.Configure
invocations fails if it has noOptionsBuilder.Bind[Configuration]
invocations.this fails because we reference options APIs without emitting the needed namespace
this passes because the needed namespace is emitted due to intercepting options builder invocation
Testing
We had tests that covered the regressed case, but we were only comparing the compiler output and not actually compiling it. This change makes sure we compile all the baselines and either assert that they are clean or only contain expected diagnostics.
Improves unit tests by examining final compilation in addition to the intermediate compilation after running the generator. This will prevent generator iterative changes from regressing successful compilation for any of the emitted interceptors.
The reinforced
Configure
overload baseline tests verify that the regression has been fixed.Risk
Low.