Ensure Refit v11 compatibility#1111
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis 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. ChangesRefit 11.0.1 Upgrade and net10.0 Support
Sequence DiagramsequenceDiagram
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)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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 liftPackage 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 liftPackage 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
📒 Files selected for processing (11)
src/Refitter.SourceGenerator.Tests/Build/ProjectFileContents.cssrc/Refitter.SourceGenerator.Tests/Refitter.SourceGenerator.Tests.csprojsrc/Refitter.Tests/Build/BuildHelper.cssrc/Refitter.Tests/Build/ProjectFileContents.cssrc/Refitter.Tests/Scenarios/GenerateJsonSerializerContextPolymorphismTests.cssrc/Refitter.Tests/Scenarios/Refit11CompatibilityTests.cstest/ConsoleApp/Directory.Build.propstest/HelloWorld/HelloWorld/HelloWorld.csprojtest/MSBuild/Refitter.MSBuild.Tests.csprojtest/MinimalApi/MinimalApi.csprojtest/MultipleFiles/Client/Client.csproj
| [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(); | ||
| } |
There was a problem hiding this comment.
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 Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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
📒 Files selected for processing (1)
src/Refitter.SourceGenerator.Tests/Build/ProjectFileContents.cs
| <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"" /> |
There was a problem hiding this comment.
🧩 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 -20Repository: 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 || trueRepository: 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" || trueRepository: 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 80Repository: 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
doneRepository: 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 -baRepository: 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 -baRepository: 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 || trueRepository: 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 -uRepository: 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
fiRepository: 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
fiRepository: 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 referenceMicrosoft.Extensions.Http.ResilienceVersion="10.0.8", but NuGet’s flat-containermicrosoft.extensions.http.resilience/index.jsondoesn’t list10.0.8(it lists10.0.0,10.1.0…10.6.0), so package restore is likely to fail—update to an available version. - The earlier
Microsoft.Extensions.*/net8.0+net9.0compatibility concern is mostly covered:Refit.HttpClientFactory 11.0.1brings inMicrosoft.Extensions.Http10.0.8fornet8.0/net9.0, andMicrosoft.Extensions.Http/Microsoft.Extensions.DependencyInjection/Microsoft.Extensions.Options.ConfigurationExtensions10.0.8nuspecs includenet8.0andnet9.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.
|



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:
RefitandRefit.HttpClientFactorypackage references in test and sample projects to version11.0.1, and upgraded related dependencies (such asSystem.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:
Net100ApptoProjectFileContentsand updatedBuildHelper.BuildCSharpto support building projects targeting.NET 10.0, enabling testing against the latest framework. [1] [2]Compatibility tests:
Refit11CompatibilityTeststhat 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
Chores