Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions Stellar.SourceGenerators/ServiceRegistrationAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ public class ServiceRegistrationAttribute : Attribute
public Lifetime ServiceRegistrationType { get; set; }

public bool RegisterInterfaces { get; set; }

public Type? ServiceType { get; set; }

public string? Key { get; set; }

public ServiceRegistrationAttribute()
{
ServiceRegistrationType = Lifetime.Transient;
}

public ServiceRegistrationAttribute(Lifetime serviceRegistrationType)
{
ServiceRegistrationType = serviceRegistrationType;
}

public ServiceRegistrationAttribute(Lifetime serviceRegistrationType = Lifetime.Transient, bool registerInterfaces = false)
public ServiceRegistrationAttribute(
Lifetime serviceRegistrationType = Lifetime.Transient,
bool registerInterfaces = false,
Type? serviceType = null,
string? key = null)
{
Comment on lines +16 to 21
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

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

The PR description shows applying multiple [ServiceRegistration] attributes to the same class (multiple keys), but this attribute does not set AllowMultiple=true, so consumers will get a compile-time error when stacking the attribute. Update the AttributeUsage to allow multiple (and ensure the runtime copy of this attribute in Stellar/ServiceRegistrationAttribute.cs is updated the same way).

Copilot uses AI. Check for mistakes.
ServiceRegistrationType = serviceRegistrationType;
RegisterInterfaces = registerInterfaces;
ServiceType = serviceType;
Key = key;
Comment on lines 10 to +25
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

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

This project defines ServiceRegistrationAttribute here, but consuming projects reference Stellar.SourceGenerators as an analyzer-only reference (e.g., Stellar.MauiSample.csproj sets ReferenceOutputAssembly="false"), meaning the attribute type used in user code comes from the runtime assembly (Stellar/ServiceRegistrationAttribute.cs). That runtime attribute currently lacks ServiceType/Key and the updated ctor signature, so the new usage examples in the PR description won’t compile until the runtime attribute is updated to match these new members.

Copilot uses AI. Check for mistakes.
}
}

Expand Down
Loading
Loading