Skip to content

Source Generator should scan for RegisterProvider attributes at build time #9730

Closed

Description

@ReubenBond

To support configuring providers directly from IConfiguration (eg, emitted by Aspire), we scan for [RegisterProvider(...)] attributes in all assemblies. This should be done via code generation instead. i.e, we should create a list of the known providers in generated metadata instead of needing to perform assembly scanning and reflection.

Here are some relevant code references:

Scanning on the client:

foreach (var attr in asm.GetCustomAttributes<RegisterProviderAttribute>())

Scanning on the silo:

foreach (var attr in asm.GetCustomAttributes<RegisterProviderAttribute>())

The RegisterProviderAttribute definition:

public sealed class RegisterProviderAttribute(

TypeManifestOptions:

public sealed class TypeManifestOptions

MetadataGenerator:
https://github.com/dotnet/orleans/blob/f23233a70dd3c4d5f216c7be2aa2ed8faca7a58a/src/Orleans.CodeGenerator/MetadataGenerator.cs

Activity

  1. locked and limited conversation to collaborators on Sep 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions