Skip to content

Ensure Refit v11 compatibility#1111

Merged
christianhelle merged 6 commits into
mainfrom
refit-11
Jun 6, 2026
Merged

Ensure Refit v11 compatibility#1111
christianhelle merged 6 commits into
mainfrom
refit-11

Conversation

@christianhelle

@christianhelle christianhelle commented Jun 6, 2026

Copy link
Copy Markdown
Owner

This pull request updates the test infrastructure and dependencies to support and validate compatibility with Refit 11 and .NET 10.0. The main changes include upgrading all relevant Refit and related package references to their latest versions, introducing support for .NET 10.0 in test project scaffolding, and adding comprehensive compatibility tests to ensure generated code works with Refit 11 and the new framework version.

Dependency upgrades:

  • Updated all Refit and Refit.HttpClientFactory package references in test and sample projects to version 11.0.1, and upgraded related dependencies (such as System.Text.Json, System.ComponentModel.Annotations, and Microsoft.Extensions.* packages) to their latest compatible versions. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

Test project enhancements:

  • Added a new constant Net100App to ProjectFileContents and updated BuildHelper.BuildCSharp to support building projects targeting .NET 10.0, enabling testing against the latest framework. [1] [2]

Compatibility tests:

  • Introduced a new test class Refit11CompatibilityTests that verifies generated code builds successfully with Refit 11 under various settings and OpenAPI inputs, ensuring robust compatibility for multiple generator features.

Summary by CodeRabbit

  • Tests

    • Added comprehensive compatibility tests for Refit 11 covering many code-generation options and build scenarios.
  • Chores

    • Bumped Refit and Refit.HttpClientFactory to v11.0.1 and updated System.Text.Json / Microsoft.Extensions packages to newer 10.x/11.x series.
    • Added support for targeting .NET 10.0.

@christianhelle christianhelle self-assigned this Jun 6, 2026
@christianhelle christianhelle added enhancement New feature, bug fix, or request dependencies Pull requests that update a dependency file labels Jun 6, 2026
@coderabbitai

coderabbitai Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 59a2b288-9594-4e76-ae90-36bd8a1482ba

📥 Commits

Reviewing files that changed from the base of the PR and between 96357e4 and 493007e.

📒 Files selected for processing (1)
  • test/ConsoleApp/Directory.Build.props
🚧 Files skipped from review as they are similar to previous changes (1)
  • test/ConsoleApp/Directory.Build.props

📝 Walkthrough

Walkthrough

This PR upgrades Refit/Refit.HttpClientFactory to 11.0.1 across test projects and embedded templates, adds net10.0 support in the test build helper and ProjectFileContents, and introduces Refit11CompatibilityTests that generate and compile Refit client code under multiple settings targeting net10.0.

Changes

Refit 11.0.1 Upgrade and net10.0 Support

Layer / File(s) Summary
Build helper and source-generator test project update
src/Refitter.SourceGenerator.Tests/Refitter.SourceGenerator.Tests.csproj, src/Refitter.Tests/Build/BuildHelper.cs
BuildHelper accepts "net10.0" and maps it to ProjectFileContents.Net100App. Refit.HttpClientFactory reference in the source-generator test project updated to 11.0.1.
Embedded project templates dependency bumps
src/Refitter.Tests/Build/ProjectFileContents.cs, src/Refitter.SourceGenerator.Tests/Build/ProjectFileContents.cs
Embedded .csproj templates for Net80App, Net90App, and Net100App updated: Refit.HttpClientFactory set to 11.0.1 and related System.Text.Json, System.ComponentModel.Annotations, and Microsoft.Extensions.* package versions bumped from 8.x to 10.x/11.x where present.
Refit 11 compatibility test suite
src/Refitter.Tests/Scenarios/Refit11CompatibilityTests.cs
New Refit11CompatibilityTests class targeting net10.0 with multiple parameterized tests that generate Refit client code with varied RefitGeneratorSettings and assert generated code builds. Includes GenerateCode helper.
Test projects package updates
src/Refitter.Tests/Scenarios/GenerateJsonSerializerContextPolymorphismTests.cs, test/ConsoleApp/Directory.Build.props, test/HelloWorld/HelloWorld/HelloWorld.csproj, test/MSBuild/Refitter.MSBuild.Tests.csproj, test/MinimalApi/MinimalApi.csproj, test/MultipleFiles/Client/Client.csproj
Bump Refit and/or Refit.HttpClientFactory to 11.0.1 across test apps and update an embedded runtime project reference used by a serialization test.

Sequence Diagram

sequenceDiagram
  participant TestSuite as Refit11CompatibilityTests
  participant Generator as GenerateCode
  participant RefitGen as RefitGenerator
  participant Builder as BuildHelper
  TestSuite->>Generator: request generated code (version, filename, settings)
  Generator->>RefitGen: invoke generator with settings and embedded swagger
  RefitGen-->>Generator: return generated C# code
  TestSuite->>Builder: BuildCSharp(net10.0, generated code)
  Builder-->>TestSuite: build result (success/failure)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

\.NET

"A rabbit hopped through code and tree,
Bumped packages up to eleven with glee,
net10 joined the test parade,
Generated clients compiled and stayed,
Hooray — the build runs merrily!" 🐇✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Ensure Refit v11 compatibility' clearly and directly summarizes the main objective of the changeset, which is to update dependencies and test infrastructure to support and validate Refit 11 compatibility.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refit-11

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/Refitter.SourceGenerator.Tests/Build/ProjectFileContents.cs (1)

12-29: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Package version inconsistency with src/Refitter.Tests/Build/ProjectFileContents.cs.

This file updates only Refit.HttpClientFactory to 11.0.1 while keeping Microsoft.Extensions packages at 8.x versions. However, src/Refitter.Tests/Build/ProjectFileContents.cs updates both Refit.HttpClientFactory to 11.0.1 AND all Microsoft.Extensions.* packages to 10.x versions.

If Refit 11.x requires or is better compatible with newer Microsoft.Extensions packages, this mismatch could cause runtime issues or prevent tests from validating real-world scenarios.

Consider aligning the package versions between both ProjectFileContents files by also updating:

  • System.Text.Json: 8.0.5 → 10.0.0
  • Microsoft.Extensions.DependencyInjection: 8.0.1 → 10.0.8
  • Microsoft.Extensions.Http.Polly: 8.0.11 → 10.0.8
  • Microsoft.Extensions.Http.Resilience: 8.10.0 → 10.0.8
  • Microsoft.Extensions.Options.ConfigurationExtensions: 8.0.0 → 10.0.8
🔍 Verify package compatibility
#!/bin/bash
# Check Refit 11.0.1 dependencies
curl -s "https://api.nuget.org/v3-flatcontainer/refit.httpclientfactory/11.0.1/refit.httpclientfactory.nuspec" | grep -A 10 "<dependencies>"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/Refitter.SourceGenerator.Tests/Build/ProjectFileContents.cs` around lines
12 - 29, The ProjectFileContents ItemGroup lists packages where
Refit.HttpClientFactory is updated to 11.0.1 but several Microsoft.Extensions
and System.Text.Json packages remain on 8.x, causing a version mismatch with the
other ProjectFileContents; update the PackageReference entries for
System.Text.Json, Microsoft.Extensions.DependencyInjection,
Microsoft.Extensions.Http.Polly, Microsoft.Extensions.Http.Resilience, and
Microsoft.Extensions.Options.ConfigurationExtensions to the 10.x versions used
in src/Refitter.Tests/Build/ProjectFileContents.cs (e.g., System.Text.Json →
10.0.0, Microsoft.Extensions.* → 10.0.8) so both ProjectFileContents files use
consistent package versions.
♻️ Duplicate comments (1)
src/Refitter.SourceGenerator.Tests/Build/ProjectFileContents.cs (1)

39-56: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Package version inconsistency with src/Refitter.Tests/Build/ProjectFileContents.cs.

Same concern as Net80App—this Net90App template updates only Refit.HttpClientFactory to 11.0.1 while keeping Microsoft.Extensions packages at 8.x, creating inconsistency with the more comprehensive updates in src/Refitter.Tests/Build/ProjectFileContents.cs.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/Refitter.SourceGenerator.Tests/Build/ProjectFileContents.cs` around lines
39 - 56, The Microsoft.Extensions package versions in this Net90App
ProjectFileContents are inconsistent with the other template; update the
PackageReference entries for Microsoft.Extensions.DependencyInjection,
Microsoft.Extensions.Http.Polly, Microsoft.Extensions.Http.Resilience, and
Microsoft.Extensions.Options.ConfigurationExtensions to the same major/minor
versions used in src/Refitter.Tests/Build/ProjectFileContents.cs (i.e., align
their versions with that file) so all templates use consistent
Microsoft.Extensions package versions alongside the bumped
Refit.HttpClientFactory.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/Refitter.Tests/Scenarios/Refit11CompatibilityTests.cs`:
- Around line 14-26: The test Can_Build_Generated_Code_With_Refit_11 has
duplicate Arguments for SwaggerPetstoreYamlV3; change the fourth Arguments
attribute to use the V2 YAML sample
(SampleOpenSpecifications.SwaggerPetstoreYamlV2, "SwaggerPetstore.yaml") so the
suite covers both OpenAPI v2 JSON and YAML inputs; update the Arguments(...)
line that currently references SwaggerPetstoreYamlV3 to reference
SwaggerPetstoreYamlV2.

---

Outside diff comments:
In `@src/Refitter.SourceGenerator.Tests/Build/ProjectFileContents.cs`:
- Around line 12-29: The ProjectFileContents ItemGroup lists packages where
Refit.HttpClientFactory is updated to 11.0.1 but several Microsoft.Extensions
and System.Text.Json packages remain on 8.x, causing a version mismatch with the
other ProjectFileContents; update the PackageReference entries for
System.Text.Json, Microsoft.Extensions.DependencyInjection,
Microsoft.Extensions.Http.Polly, Microsoft.Extensions.Http.Resilience, and
Microsoft.Extensions.Options.ConfigurationExtensions to the 10.x versions used
in src/Refitter.Tests/Build/ProjectFileContents.cs (e.g., System.Text.Json →
10.0.0, Microsoft.Extensions.* → 10.0.8) so both ProjectFileContents files use
consistent package versions.

---

Duplicate comments:
In `@src/Refitter.SourceGenerator.Tests/Build/ProjectFileContents.cs`:
- Around line 39-56: The Microsoft.Extensions package versions in this Net90App
ProjectFileContents are inconsistent with the other template; update the
PackageReference entries for Microsoft.Extensions.DependencyInjection,
Microsoft.Extensions.Http.Polly, Microsoft.Extensions.Http.Resilience, and
Microsoft.Extensions.Options.ConfigurationExtensions to the same major/minor
versions used in src/Refitter.Tests/Build/ProjectFileContents.cs (i.e., align
their versions with that file) so all templates use consistent
Microsoft.Extensions package versions alongside the bumped
Refit.HttpClientFactory.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2898cd0b-6bba-4b5e-b05c-cdc549ff482a

📥 Commits

Reviewing files that changed from the base of the PR and between 919536b and 2af8476.

📒 Files selected for processing (11)
  • src/Refitter.SourceGenerator.Tests/Build/ProjectFileContents.cs
  • src/Refitter.SourceGenerator.Tests/Refitter.SourceGenerator.Tests.csproj
  • src/Refitter.Tests/Build/BuildHelper.cs
  • src/Refitter.Tests/Build/ProjectFileContents.cs
  • src/Refitter.Tests/Scenarios/GenerateJsonSerializerContextPolymorphismTests.cs
  • src/Refitter.Tests/Scenarios/Refit11CompatibilityTests.cs
  • test/ConsoleApp/Directory.Build.props
  • test/HelloWorld/HelloWorld/HelloWorld.csproj
  • test/MSBuild/Refitter.MSBuild.Tests.csproj
  • test/MinimalApi/MinimalApi.csproj
  • test/MultipleFiles/Client/Client.csproj

Comment on lines +14 to +26
[Test]
[Arguments(SampleOpenSpecifications.SwaggerPetstoreJsonV3, "SwaggerPetstore.json")]
[Arguments(SampleOpenSpecifications.SwaggerPetstoreYamlV3, "SwaggerPetstore.yaml")]
[Arguments(SampleOpenSpecifications.SwaggerPetstoreJsonV2, "SwaggerPetstore.json")]
[Arguments(SampleOpenSpecifications.SwaggerPetstoreYamlV3, "SwaggerPetstore.yaml")]
public async Task Can_Build_Generated_Code_With_Refit_11(SampleOpenSpecifications version, string filename)
{
var generatedCode = await GenerateCode(version, filename);
BuildHelper
.BuildCSharp(Refit11TargetFramework, generatedCode)
.Should()
.BeTrue();
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Duplicate test argument—V2 YAML never tested.

Line 18 repeats SwaggerPetstoreYamlV3 from line 16. Based on the pattern in line 17 (SwaggerPetstoreJsonV2), line 18 should likely be SwaggerPetstoreYamlV2 to ensure OpenAPI v2 YAML inputs are tested.

📝 Proposed fix
     [Arguments(SampleOpenSpecifications.SwaggerPetstoreJsonV3, "SwaggerPetstore.json")]
     [Arguments(SampleOpenSpecifications.SwaggerPetstoreYamlV3, "SwaggerPetstore.yaml")]
     [Arguments(SampleOpenSpecifications.SwaggerPetstoreJsonV2, "SwaggerPetstore.json")]
-    [Arguments(SampleOpenSpecifications.SwaggerPetstoreYamlV3, "SwaggerPetstore.yaml")]
+    [Arguments(SampleOpenSpecifications.SwaggerPetstoreYamlV2, "SwaggerPetstore.yaml")]
     public async Task Can_Build_Generated_Code_With_Refit_11(SampleOpenSpecifications version, string filename)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/Refitter.Tests/Scenarios/Refit11CompatibilityTests.cs` around lines 14 -
26, The test Can_Build_Generated_Code_With_Refit_11 has duplicate Arguments for
SwaggerPetstoreYamlV3; change the fourth Arguments attribute to use the V2 YAML
sample (SampleOpenSpecifications.SwaggerPetstoreYamlV2, "SwaggerPetstore.yaml")
so the suite covers both OpenAPI v2 JSON and YAML inputs; update the
Arguments(...) line that currently references SwaggerPetstoreYamlV3 to reference
SwaggerPetstoreYamlV2.

@codecov

codecov Bot commented Jun 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.32%. Comparing base (746a540) to head (493007e).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1111   +/-   ##
=======================================
  Coverage   95.32%   95.32%           
=======================================
  Files          28       28           
  Lines        3013     3013           
=======================================
  Hits         2872     2872           
  Misses         45       45           
  Partials       96       96           
Flag Coverage Δ
unittests 95.32% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/Refitter.SourceGenerator.Tests/Build/ProjectFileContents.cs`:
- Around line 16-19: The test project template in ProjectFileContents
(src/Refitter.SourceGenerator.Tests/Build/ProjectFileContents.cs) references
Microsoft.Extensions.Http.Resilience Version="10.0.8", which does not exist on
NuGet; update that package reference to an available version (for example
"10.6.0") in both occurrences inside the template strings (the two places around
the XML PackageReference blocks — the earlier block and the later block around
lines ~43-46) so package restore succeeds; ensure you update the same literal in
the ProjectFileContents class/template so both net8.0/net9.0 test templates use
the valid version.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8d4e2d73-a72b-4536-aa38-dd6118aa0b5f

📥 Commits

Reviewing files that changed from the base of the PR and between 2af8476 and 96357e4.

📒 Files selected for processing (1)
  • src/Refitter.SourceGenerator.Tests/Build/ProjectFileContents.cs

Comment on lines +16 to +19
<PackageReference Include=""Microsoft.Extensions.DependencyInjection"" Version=""10.0.8"" />
<PackageReference Include=""Microsoft.Extensions.Http.Polly"" Version=""10.0.8"" />
<PackageReference Include=""Microsoft.Extensions.Http.Resilience"" Version=""10.0.8"" />
<PackageReference Include=""Microsoft.Extensions.Options.ConfigurationExtensions"" Version=""10.0.8"" />

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if Refit 11.0.1 has specific Microsoft.Extensions version requirements

# Query NuGet API for Refit.HttpClientFactory 11.0.1 dependencies
echo "=== Refit.HttpClientFactory 11.0.1 dependencies ==="
curl -s "https://api.nuget.org/v3-flatcontainer/refit.httpclientfactory/11.0.1/refit.httpclientfactory.nuspec" | \
  grep -A 5 "dependencies" | head -30

# Check Microsoft.Extensions.DependencyInjection 10.0.8 supported frameworks
echo -e "\n=== Microsoft.Extensions.DependencyInjection 10.0.8 target frameworks ==="
curl -s "https://api.nuget.org/v3-flatcontainer/microsoft.extensions.dependencyinjection/10.0.8/microsoft.extensions.dependencyinjection.nuspec" | \
  grep -E "(targetFramework|dependency)" | head -20

# Check Microsoft.Extensions.Http.Polly 10.0.8 supported frameworks
echo -e "\n=== Microsoft.Extensions.Http.Polly 10.0.8 target frameworks ==="
curl -s "https://api.nuget.org/v3-flatcontainer/microsoft.extensions.http.polly/10.0.8/microsoft.extensions.http.polly.nuspec" | \
  grep -E "(targetFramework|dependency)" | head -20

Repository: christianhelle/refitter

Length of output: 2540


🏁 Script executed:

#!/bin/bash
set -euo pipefail

pkgs=(
  "microsoft.extensions.dependencyinjection/10.0.8"
  "microsoft.extensions.http.polly/10.0.8"
  "microsoft.extensions.http.resilience/10.0.8"
  "microsoft.extensions.options.configurationextensions/10.0.8"
  "microsoft.extensions.http/10.0.8"
)

echo "=== Supported targetFramework groups for Microsoft.Extensions packages ==="
for p in "${pkgs[@]}"; do
  pkg="$(echo "$p" | cut -d/ -f1)"
  ver="$(echo "$p" | cut -d/ -f2)"
  echo -e "\n--- $pkg $ver ---"
  curl -s "https://api.nuget.org/v3-flatcontainer/${pkg}/${ver}/${pkg}.${ver}.nuspec" \
    | rg -o 'group targetFramework="[^"]+"' \
    | sed 's/group targetFramework="//; s/"$//' \
    | sort -u
done

echo -e "\n=== Refit.HttpClientFactory 11.0.1 nuspec dependency groups (context) ==="
curl -s "https://api.nuget.org/v3-flatcontainer/refit.httpclientfactory/11.0.1/refit.httpclientfactory.nuspec" \
  | rg -n "dependencies|group targetFramework|Microsoft.Extensions.Http" -n || true

Repository: christianhelle/refitter

Length of output: 199


🏁 Script executed:

#!/bin/bash
set -uo pipefail

pkgs=(
  "microsoft.extensions.dependencyinjection/10.0.8"
  "microsoft.extensions.http.polly/10.0.8"
  "microsoft.extensions.http.resilience/10.0.8"
  "microsoft.extensions.options.configurationextensions/10.0.8"
  "microsoft.extensions.http/10.0.8"
)

echo "=== Supported targetFramework groups for Microsoft.Extensions packages ==="
for p in "${pkgs[@]}"; do
  pkg="$(echo "$p" | cut -d/ -f1)"
  ver="$(echo "$p" | cut -d/ -f2)"
  echo -e "\n--- $pkg $ver ---"

  url="https://api.nuget.org/v3-flatcontainer/${pkg}/${ver}/${pkg}.${ver}.nuspec"
  nuspec="$(curl -sS "$url" || true)"
  if [[ -z "$nuspec" ]]; then
    echo "(nuspec fetch failed or empty: $url)"
    continue
  fi

  groups="$(printf "%s" "$nuspec" | rg -n --no-messages 'group targetFramework="' || true)"
  if [[ -z "$groups" ]]; then
    echo "(no 'group targetFramework' entries found in nuspec)"
    continue
  fi

  printf "%s" "$nuspec" \
    | rg -o --no-messages 'group targetFramework="[^"]+"' \
    | sed 's/group targetFramework="//; s/"$//' \
    | sort -u
done

echo -e "\n=== Refit.HttpClientFactory 11.0.1 nuspec dependency groups (context) ==="
curl -sS "https://api.nuget.org/v3-flatcontainer/refit.httpclientfactory/11.0.1/refit.httpclientfactory.nuspec" \
  | rg -n --no-messages "dependencies|group targetFramework=\"|Microsoft.Extensions.Http" || true

Repository: christianhelle/refitter

Length of output: 1540


🏁 Script executed:

#!/bin/bash
set -euo pipefail

pkg="microsoft.extensions.dependencyinjection"
ver="10.0.8"
url="https://api.nuget.org/v3-flatcontainer/${pkg}/${ver}/${pkg}.${ver}.nuspec"

echo "URL: $url"
echo "---- curl headers ----"
curl -sS -I "$url" | sed -n '1,20p'

echo "---- nuspec head (first 80 lines) ----"
curl -sS "$url" | head -n 80

echo "---- grep targetFramework/group/dependency lines ----"
curl -sS "$url" \
  | rg -n --no-messages "(targetFramework|<group|<dependency|dependency id=)" \
  | head -n 80

Repository: christianhelle/refitter

Length of output: 1036


🏁 Script executed:

#!/bin/bash
set -euo pipefail

packages=(
  "microsoft.extensions.dependencyinjection 10.0.8"
  "microsoft.extensions.http.polly 10.0.8"
  "microsoft.extensions.http.resilience 10.0.8"
  "microsoft.extensions.options.configurationextensions 10.0.8"
  "microsoft.extensions.http 10.0.8"
)

echo "=== Check nuspec for dependency groups / target frameworks (net8.0/net9.0) ==="
for item in "${packages[@]}"; do
  pkg="$(awk '{print $1}' <<<"$item")"
  ver="$(awk '{print $2}' <<<"$item")"
  url="https://api.nuget.org/v3-flatcontainer/${pkg}/${ver}/${pkg}.nuspec"

  echo -e "\n--- $pkg $ver ---"
  nuspec="$(curl -sS "$url" || true)"
  if [[ -z "$nuspec" || "$nuspec" == *"BlobNotFound"* ]]; then
    echo "(nuspec not found at $url)"
    continue
  fi

  echo "Has group targetFramework entries?"
  printf "%s" "$nuspec" | rg -o --no-messages 'targetFramework="[^"]+"' | sort -u | head -n 50

  echo "Contains net8.0 group?"
  printf "%s" "$nuspec" | rg --no-messages 'targetFramework="net8\.0"' || true

  echo "Contains net9.0 group?"
  printf "%s" "$nuspec" | rg --no-messages 'targetFramework="net9\.0"' || true
done

Repository: christianhelle/refitter

Length of output: 1637


🏁 Script executed:

#!/bin/bash
set -euo pipefail

file="src/Refitter.SourceGenerator.Tests/Build/ProjectFileContents.cs"
echo "=== PackageReference lines in $file ==="
rg -n --fixed-string 'PackageReference' "$file"

echo
echo "=== Full context around the Microsoft.Extensions.* PackageReferences ==="
sed -n '1,120p' "$file" | nl -ba

Repository: christianhelle/refitter

Length of output: 631


🏁 Script executed:

#!/bin/bash
set -euo pipefail

file="src/Refitter.SourceGenerator.Tests/Build/ProjectFileContents.cs"

echo "=== PackageReference lines in $file ==="
rg -n --fixed-strings 'PackageReference' "$file"

echo
echo "=== Microsoft.Extensions.* PackageReference lines (with versions) ==="
rg -n --fixed-strings 'PackageReference Include="Microsoft.Extensions' "$file" || true

echo
echo "=== Show surrounding Net80App template lines 1-80 ==="
sed -n '1,80p' "$file" | nl -ba

echo
echo "=== Show surrounding Net90App template lines 80-180 ==="
sed -n '80,180p' "$file" | nl -ba

Repository: christianhelle/refitter

Length of output: 3417


🏁 Script executed:

#!/bin/bash
set -euo pipefail

file="src/Refitter.SourceGenerator.Tests/Build/ProjectFileContents.cs"

echo "=== Microsoft.Extensions.* PackageReference lines in $file ==="
rg -n --fixed-strings 'PackageReference Include="Microsoft.Extensions' "$file"

echo
echo "=== Show Net80App/Net90App templates around the Microsoft.Extensions.* references ==="
# small slices around the known line numbers from previous grep output
sed -n '1,90p' "$file" | cat -n | sed -n '1,90p'
sed -n '90,180p' "$file" | cat -n | sed -n '1,120p'

echo
echo "=== NuGet nuspec existence + targetFramework groups for Microsoft.Extensions.Http.Resilience 10.0.8 ==="
pkg="microsoft.extensions.http.resilience"
ver="10.0.8"

index_url="https://api.nuget.org/v3-flatcontainer/${pkg}/index.json"
echo "index_url: $index_url"
curl -sS "$index_url" | head -n 5

nuspec_url="https://api.nuget.org/v3-flatcontainer/${pkg}/${ver}/${pkg}.${ver}.nuspec"
echo "nuspec_url: $nuspec_url"
curl -sS -I "$nuspec_url" | head -n 20

echo
echo "--- nuspec targetFramework values (if available) ---"
curl -sS "$nuspec_url" | rg -o --no-messages 'targetFramework="[^"]+"' | sed 's/targetFramework="//; s/"$//' | sort -u || true

Repository: christianhelle/refitter

Length of output: 188


🏁 Script executed:

#!/bin/bash
set -euo pipefail

file="src/Refitter.SourceGenerator.Tests/Build/ProjectFileContents.cs"

echo "=== File exists / head ==="
ls -l "$file"
sed -n '1,80p' "$file" | head -n 40

echo
echo "=== Microsoft.Extensions.* PackageReference lines (escaped quotes) ==="
rg -n 'PackageReference Include=""Microsoft\.Extensions\.' "$file"

echo
echo "=== nuspec targetFramework values for Microsoft.Extensions.Http.Resilience 10.0.8 ==="
pkg="microsoft.extensions.http.resilience"
ver="10.0.8"

nuspec_url="https://api.nuget.org/v3-flatcontainer/${pkg}/${ver}/${pkg}.${ver}.nuspec"
echo "nuspec_url: $nuspec_url"
curl -sS -I "$nuspec_url" | head -n 15

echo
echo "--- extracted targetFramework values (if present) ---"
curl -sS "$nuspec_url" | rg -o --no-messages 'targetFramework="[^"]+"' | sed 's/targetFramework="//; s/"$//' | sort -u

Repository: christianhelle/refitter

Length of output: 4082


🏁 Script executed:

#!/bin/bash
set -euo pipefail

pkg="microsoft.extensions.http.resilience"
idx_url="https://api.nuget.org/v3-flatcontainer/${pkg}/index.json"

echo "index_url: $idx_url"
idx="$(curl -sS "$idx_url" || true)"
if [[ -z "$idx" ]]; then
  echo "Failed to fetch index.json"
  exit 0
fi

echo "Does index.json mention 10.0.8?"
if echo "$idx" | rg -q '"10\.0\.8"'; then
  echo "Yes: contains 10.0.8"
else
  echo "No: 10.0.8 not found in index.json"
  echo "Some 10.0.* versions:"
  echo "$idx" | rg -o '"10\.[0-9]+\.[0-9]+"' | rg -o '"10\.[0-9]+\.[0-9]+"' | head -n 30
fi

# If 10.0.8 is present, attempt nuspec fetch again and parse targetFrameworks
if echo "$idx" | rg -q '"10\.0\.8"'; then
  ver="10.0.8"
  nuspec_url="https://api.nuget.org/v3-flatcontainer/${pkg}/${ver}/${pkg}.${ver}.nuspec"
  echo "nuspec_url: $nuspec_url"
  curl -sS -I "$nuspec_url" | head -n 15
  nuspec="$(curl -sS "$nuspec_url" || true)"
  if [[ -z "$nuspec" || "$nuspec" == *"BlobNotFound"* ]]; then
    echo "nuspec still missing via flatcontainer; will stop."
    exit 0
  fi
  echo "Extracted targetFramework values:"
  echo "$nuspec" | rg -o --no-messages 'targetFramework="[^"]+"' | sed 's/targetFramework="//; s/"$//' | sort -u
fi

Repository: christianhelle/refitter

Length of output: 317


🏁 Script executed:

#!/bin/bash
set -euo pipefail

pkg="microsoft.extensions.http.resilience"
idx_url="https://api.nuget.org/v3-flatcontainer/${pkg}/index.json"

echo "index_url: $idx_url"
idx="$(curl -sS "$idx_url" || true)"
if [[ -z "$idx" ]]; then
  echo "Failed to fetch index.json"
  exit 0
fi

echo "Does index.json mention 10.0.8?"
if echo "$idx" | rg -q '"10\.0\.8"'; then
  echo "Yes: contains 10.0.8"
else
  echo "No: 10.0.8 not found in index.json"
  echo "Some 10.0.* versions:"
  echo "$idx" | rg -o '"10\.[0-9]+\.[0-9]+"' | head -n 30
fi

# If 10.0.8 is present, attempt nuspec fetch again and parse targetFrameworks
if echo "$idx" | rg -q '"10\.0\.8"'; then
  ver="10.0.8"
  nuspec_url="https://api.nuget.org/v3-flatcontainer/${pkg}/${ver}/${pkg}.${ver}.nuspec"
  echo "nuspec_url: $nuspec_url"
  curl -sS -I "$nuspec_url" | head -n 15
  nuspec="$(curl -sS "$nuspec_url" || true)"
  if [[ -z "$nuspec" || "$nuspec" == *"BlobNotFound"* ]]; then
    echo "nuspec still missing via flatcontainer; will stop."
    exit 0
  fi
  echo "Extracted targetFramework values:"
  echo "$nuspec" | rg -o --no-messages 'targetFramework="[^"]+"' | sed 's/targetFramework="//; s/"$//' | sort -u
fi

Repository: christianhelle/refitter

Length of output: 317


Fix Microsoft.Extensions.Http.Resilience version in test templates

  • In src/Refitter.SourceGenerator.Tests/Build/ProjectFileContents.cs (lines 16-19 and 43-46), the templates reference Microsoft.Extensions.Http.Resilience Version="10.0.8", but NuGet’s flat-container microsoft.extensions.http.resilience/index.json doesn’t list 10.0.8 (it lists 10.0.0, 10.1.010.6.0), so package restore is likely to fail—update to an available version.
  • The earlier Microsoft.Extensions.*/net8.0+net9.0 compatibility concern is mostly covered: Refit.HttpClientFactory 11.0.1 brings in Microsoft.Extensions.Http 10.0.8 for net8.0/net9.0, and Microsoft.Extensions.Http / Microsoft.Extensions.DependencyInjection / Microsoft.Extensions.Options.ConfigurationExtensions 10.0.8 nuspecs include net8.0 and net9.0.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/Refitter.SourceGenerator.Tests/Build/ProjectFileContents.cs` around lines
16 - 19, The test project template in ProjectFileContents
(src/Refitter.SourceGenerator.Tests/Build/ProjectFileContents.cs) references
Microsoft.Extensions.Http.Resilience Version="10.0.8", which does not exist on
NuGet; update that package reference to an available version (for example
"10.6.0") in both occurrences inside the template strings (the two places around
the XML PackageReference blocks — the earlier block and the later block around
lines ~43-46) so package restore succeeds; ensure you update the same literal in
the ProjectFileContents class/template so both net8.0/net9.0 test templates use
the valid version.

@sonarqubecloud

sonarqubecloud Bot commented Jun 6, 2026

Copy link
Copy Markdown

@christianhelle christianhelle merged commit cfdc17a into main Jun 6, 2026
18 of 20 checks passed
@christianhelle christianhelle deleted the refit-11 branch June 6, 2026 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file enhancement New feature, bug fix, or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant