Skip to content
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] Enable output compilation validation in binder gen unit tests #91602

Merged
merged 1 commit into from
Sep 6, 2023

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Sep 5, 2023

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 no OptionsBuilder.Bind[Configuration] invocations.


this fails because we reference options APIs without emitting the needed namespace

ConfigurationBuilder configurationBuilder = new();
IConfiguration config = configurationBuilder.Build();
IConfigurationSection section = config.GetSection("MySection");

ServiceCollection services = new();
services.Configure<MyClass>({{paramList}});

this passes because the needed namespace is emitted due to intercepting options builder invocation

ServiceCollection services = new();
services.Configure<MyClass>({{paramList}});

OptionsBuilder<MyClass> optionsBuilder = new(services, Options.DefaultName);
optionsBuilder.BindConfiguration(""{{configureActions}});

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.

@ghost
Copy link

ghost commented Sep 5, 2023

Tagging subscribers to this area: @dotnet/area-extensions-configuration
See info in area-owners.md if you want to be subscribed.

Issue Details

Backport of #91565 to release/8.0

/cc @layomia

Customer Impact

Testing

Risk

IMPORTANT: If this backport is for a servicing release, please verify that:

  • The PR target branch is release/X.0-staging, not release/X.0.

  • If the change touches code that ships in a NuGet package, you have added the necessary package authoring and gotten it explicitly reviewed.

Author: github-actions[bot]
Assignees: -
Labels:

area-Extensions-Configuration

Milestone: -

@layomia layomia self-assigned this Sep 5, 2023
@layomia layomia added the Servicing-consider Issue for next servicing release review label Sep 5, 2023
@layomia layomia added this to the 8.0.0 milestone Sep 5, 2023
Copy link
Member

@artl93 artl93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

M2 approved.

@artl93 artl93 added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Sep 6, 2023
@ericstj ericstj merged commit 1222f14 into release/8.0 Sep 6, 2023
107 of 114 checks passed
@eerhardt eerhardt deleted the backport/pr-91565-to-release/8.0 branch September 7, 2023 14:51
@radical radical mentioned this pull request Sep 26, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Oct 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants