Skip to content

ASPIREEXPORT001 flagging 'extension' keyword-based extension methods as invalid #17604

Closed

Description

@kieronlanning

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

The newer extension method format is not supported by the Aspire.Hosting.Integration.Analyzers package (enabled through the EnableAspireIntegrationAnalyzers MSBuild property).

It is flagging the WithLikeC4Reference as not being static.

public static class AspireC4ResourceBuilderEnvExtensions
{
  extension<T>(IResourceBuilder<T> builder)
    where T : IResourceWithEnvironment
  {
    [AspireExport("withLikeC4ReferenceWithEnvironment", MethodName = "withLikeC4Reference", Description = ...)]
    public IResourceBuilder<T> WithLikeC4Reference( ... )
    {
        ...
    }
  }
}

Expected Behavior

Modern extension format is full supported.

Steps To Reproduce

No response

Exceptions (if any)

No response

Aspire doctor output

Checking Aspire environment...

Aspire Environment Check
========================

.NET SDK
  ✅ .NET 10.0.300 installed (x64)  

Container Runtime
  ✅ Docker: running (auto-detected (default)) ← active  

Environment
  ✅ HTTPS development certificate is trusted  

Summary: 3 passed, 0 warnings, 0 failed

Anything else?

Re-created from: microsoft/aspire.dev#990

Activity

  1. added
    needs-area-labelAn area label is needed to ensure this gets routed to the appropriate area owners
    on May 28, 2026
  2. joperezr commented on May 28, 2026

    @joperezr
    Member
    🤖 Aspire triage pass — 2026-05-28 16:56 UTC

    Area: area-polyglot
    Kind: bug
    Repro: yes-minimal — code sample in issue body (lines 11–25)
    Affected version(s): not specified; reporter is on .NET 10.0.300 + Aspire analyzers (latest: 13.4.0-rc.1)
    Severity: S3 — analyzer (ASPIREEXPORT001) false-positive on C# 14 extension block syntax; workaround = author the method as a classic this-parameter extension method.

    Urgency: 🟡 vNext — recommend milestone 13.5
    Reason: Analyzer in Aspire.Hosting.Integration.Analyzers doesn't recognize the new C# 14 extension-block syntax used to expose polyglot AppHost methods via [AspireExport]. Reasonable workaround exists, not blocking 13.4 ship.

    Suggested owner(s): Sébastien Ros (@sebastienros) (score 6), backup David Pine (@IEvangelist) (score 3)
    Evidence:

    Confidence: medium
    Needs human?: no

    Dry-run mode — no labels or milestone applied. Reply /triage apply to promote, or edit and reapply.

  3. added
    area-polyglotIssues related to polyglot apphosts
    and removed
    needs-area-labelAn area label is needed to ensure this gets routed to the appropriate area owners
    on May 28, 2026
  4. added this to the 13.5 milestone on May 28, 2026
  5. adamint commented on May 28, 2026

    @adamint
    Member

    Sébastien Ros (@sebastienros) is 13.5 appropriate

  6. sebastienros commented on May 28, 2026

    @sebastienros
    Contributor

    I believe this can be mitigated by adding another internal extension with the old syntax, though it's ugly. Should be fine for 13.5.

  7. added a commit that references this issue on Jun 18, 2026
    fdfea43
  8. locked and limited conversation to collaborators on Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-polyglotIssues related to polyglot apphoststriage:bot-seenAspire triage bot has seen this issue

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions