Skip to content

Refit should emit diagnostics for invalid interfaces #1885

Closed

Description

@TimothyMakkison

Refit should emit diagnostic warnings and errors for invalid methods and interfaces. Many exceptions in RequestBuilderImplementation could be statically determined via a source generator.

  • Invalid url backslash
  • Multiple CancellationToken params
  • HeadersCollection must be IDictionary

Severity to be determined layer.

More advanced checks may to read the attribute values. It isn't required but I'd prefer to reference ../Refit.csproj and construct each attribute in the source generator. I don't know if this could cause issues 🤔

Would this be considered to be a breaking change? It may prevent users from building code that previously ran, although it was likely invalid.

Activity

  1. added
    🧩 semantic-analysis
    🟠 priority: medium
    🧬 area: source-gen
    on Jun 16, 2026
  2. added a commit that references this issue on Jul 14, 2026
    a2b1581
  3. glennawatson commented on Jul 15, 2026

    @glennawatson
    Contributor

    This is addressed in the Refit 14 beta, now available on NuGet: https://www.nuget.org/packages/Refit/14.0.0-beta.1

    Please give it a try - feedback ahead of the stable 14.0.0 release is very welcome.

    Type-safe REST API clients for .NET, generated from annotated interfaces with build-time source generation, direct request construction, System.Text.Json defaults, and support for trimming and AOT.
  4. github-actions commented on Jul 30, 2026

    @github-actions

    This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  5. locked as resolved and limited conversation to collaborators on Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ✨ enhancement🟠 priority: medium🧩 semantic-analysis🧬 area: source-gen

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions