Skip to content

Use Roslyn interceptors feature in config binder generator #89322

Description

@layomia

ref: @captainsafia's work on the request delegate source generator - dotnet/aspnetcore#48817.

cc @tarekgh @eerhardt @ericstj.

Activity

  1. added this to the 8.0.0 milestone on Jul 21, 2023
  2. self-assigned this
    on Jul 21, 2023
  3. layomia commented on Jul 21, 2023

    @layomia
    ContributorAuthor

    Can take this opportunity to fix #86363.

  4. layomia commented on Aug 9, 2023

    @layomia
    ContributorAuthor

    @tarekgh @ericstj @eiriktsarpalis looks like the interceptors feature requires <Features>$(Features);InterceptorsPreview</Features> in consuming projects. While the feature is in preview, it seems we should update the SDK to set it if EnableConfigurationBindingGenerator is set. Otherwise users would need to set two properties to use the generator.

    The Web SDK already sets the feature property when binding & RDG generates are enabled, so the concern is about regular SDK scenarios.

  5. tarekgh commented on Aug 9, 2023

    @tarekgh
    Member

    @layomia does the interceptor feature will be released the same way? I mean users have to opt-in to get it. Or is this temporary for preview and will change when it gets released?

  6. layomia commented on Aug 10, 2023

    @layomia
    ContributorAuthor

    Yes I believe interceptors will be shipped as a preview feature in GA. cc @captainsafia.

  7. ericstj commented on Aug 10, 2023

    @ericstj
    Member

    We can do the same thing as RDG here. Just add us to this condition:
    https://github.com/dotnet/sdk/blob/b3b5a2800d4de997572068332bf222e2e8f808d5/src/WebSdk/ProjectSystem/Targets/Microsoft.NET.Sdk.Web.ProjectSystem.targets#L62-L65

    We could do the same in our nuget package targets:
    https://github.com/dotnet/runtime/blob/main/src/libraries/Microsoft.Extensions.Configuration.Binder/src/buildTransitive/Microsoft.Extensions.Configuration.Binder.targets

    Might be good to have a safeguard in the generator just in case someone manages to invoke it without setting that property. I suspect RDG needs the same as well (eg Web class library that get's referenced by a normal app or class library).

  8. ghost added
    in-prThere is an active PR which will close this issue when it is merged
    on Aug 10, 2023
  9. ghost removed
    in-prThere is an active PR which will close this issue when it is merged
    on Aug 19, 2023
  10. ghost locked as resolved and limited conversation to collaborators on Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions