Tags: reactiveui/refit
Tags
feat(analyzers): explain why a method cannot generate and flag unboun… …d route placeholders (#2340) * feat(build): add opt-in RefitRequireGeneratedRequests profile - Setting RefitRequireGeneratedRequests to true promotes RF006 to an error. - Runs as a target because the consumer's project body is evaluated after refit.props. - Off by default so builds that use Refit.Reflection on purpose are unaffected. * feat(analyzers): explain why a method cannot generate and flag unbound route placeholders - The shared classifier now records the first reason a request is not generated and the parameter responsible. - RF006 reports at that parameter, return type or attribute, names the reason and remedy, and only suggests Refit.Reflection when it can run the method. - RF006 carries Reason and ParameterOrdinal properties for tooling. - Add RF015 for a route placeholder no parameter binds; the runtime check stays as a backstop. - Add classifier-backed fixtures for every reason and for the published support table. * docs(generator): correct multipart serialized-part comments - Any declared class or struct part is serialized, not only sealed ones. * test(aot): restore a reflection-backed member in the Native AOT smoke - IObservable replies are now generated, so ObserveLegacy no longer exercised the fallback. - SearchLegacyAsync(object) falls back for real, so the trim check for #2200 covers it again. * test(analyzers): cover fallback locations and drop unreachable branches - Remove IsUrlBindingSupported, which has no callers now that FindUnsupportedUrlBinding reports the ordinal. - An RF015 placeholder always comes from a source attribute's first argument, so its location lookup needs no null guard. - Cover method-level fallbacks located on the method, including one with no source declaration.
test(bodies): cover the remaining typed JSON Lines branches (#2339) * test(bodies): cover the remaining typed JSON Lines branches Adds reflection request-builder and JsonLinesContent<T> tests to close the Codecov patch-coverage gaps on PR #2338: - FindAsyncJsonLinesElementType: a class implementing IAsyncEnumerable<T> is found through GetInterfaces (rather than being that interface itself), and a type implementing two distinct IAsyncEnumerable<> interfaces is treated as ambiguous and returns null. - JsonLinesContent<T>.MoveNextAsync: a stream whose FlushAsync throws while the producer's next step is still pending propagates the failure only after that step completes, so the enumerator is never disposed while it is in flight. Two lines remain uncovered and are genuinely unreachable, not contorted around: - JsonLinesContent<T>'s 2-arg SerializeToStreamAsync override: on NET8_0_OR_GREATER, HttpContent's internal plumbing always invokes the 3-arg CancellationToken overload (verified empirically), so the 2-arg override is dead code once both are overridden; it only matters on the netfx targets that lack the 3-arg overload. - The closing brace of the catch block in MoveNextAsync: that catch always ends with 'throw;', so the sequence point for falling through the catch normally can never fire. * test(bodies): cover the .NET Framework serialize entry point and simplify the flush wait * test(bodies): arm the flush failure only after the first element is written
feat: register JSON contexts and accept JsonTypeInfo parameters (#2333) - ForGenerated, AddRefitGeneratedClient and the keyed variants take a JsonSerializerContext. Reflection-based JSON is off unless allowReflectionFallback is true. - Settings you pass keep their naming, converters, resolvers and polymorphism registrations. With none, the context's own options apply. - RefitSettings.ForJsonContext, RefitSettings.UseJsonContext, SystemTextJsonContentSerializer.ForContext and WithContext serve the reflection APIs too. - A generated method can take JsonTypeInfo<T> parameters for its JSON body and its reply. RF014 reports a parameter that cannot be used, and the reflection request builder refuses one. - IJsonTypeInfoContentSerializer adds metadata overloads to SystemTextJsonContentSerializer. - Runnable order examples show each way to set up JSON, and the Native AOT smoke test creates its client from a context.
fix(debugging): stop debugger displays rendering as a bare null (#2315) - Give every debugger display literal text alongside its placeholder. A display made of nothing but one member rendered as a bare `null` the moment that member was null, which reads as though the object itself does not exist. - ApiResponse<T> was the reported case: hovering a response that came back without content showed `null`, sending the reader looking for a NullReferenceException that was never thrown. It now leads with the type and the status code. - Ten other shipped types carried the same shape and are fixed with it. - Add DebuggerDisplayTests, which walks the shipped assemblies and fails any display whose sole placeholder can be null, plus any placeholder naming a member that does not exist. Closes #2313
fix(generator): ship a single Roslyn analyzer slot (#2305) * fix(generator): ship a single Roslyn analyzer slot - Drop the Roslyn 5.0 generator, analyzer and code fix projects so the package ships one analyzers/dotnet/roslyn4.8/cs slot. - Only the .NET SDK narrows a multi-slot package to one folder. A legacy non-SDK .csproj never runs ResolvePackageAssets, so it received both slots, ran both generators and failed to build on duplicate types. - Both builds emitted byte-identical source; the only version-specific code was collection expressions standing in for array builders. - Fail the build with REFIT001 when the compiler predates the shipped slot, which NuGet otherwise drops silently, leaving no generated clients and no explanation. - Document the build-time requirements in the README, whose SDK Requirements heading had been empty since v8.0.0. Closes #2304. * build(deps): update non-Roslyn package versions - Move all 21 stale pins to their newest release within their own major band. The Roslyn toolchain stays pinned, since its version sets the minimum compiler consumers need. - ReactiveUI.Primitives 7.0.0 -> 7.1.1 raises the runtime dependency the shipped package resolves. - Rewrite a string.Concat as interpolation and hoist a loop variable into its for header, both newly reported by the analyzer bump. - Suppress SST2461 on the DynamicallyAccessedMemberTypes polyfill, which mirrors a BCL enum whose bit 1 has no standalone member. - Disable SST1534, which reverses SST1525 and RCS1111. Braces on switch sections are the house style, and RCS1031 is already off for the same reason. * build: adopt the shared ReactiveUI editorconfig - Replace .editorconfig with the ReactiveUI copy, keeping Refit's file_header_template so source files keep their own licence header. - Keep RS0016 and RS0017 at error. They enforce the PublicAPI baselines under src/*/PublicAPI, which ReactiveUI does not track and the copy would have dropped. - Order documentation tags canonically, which SST1666 now requires. - Order the negative-valued enum fixtures ascending for SST1222. Member order carries no semantics, so the fixtures behave as before.
feat: keyed refit generated client DI registration (#2297) * feat: add AddKeyedRefitGeneratedClient for keyed generated-only DI parity AddRefitGeneratedClient<T> had no keyed counterpart, so Native AOT and trimmed apps could not register the same Refit interface more than once with different configuration without falling back to the reflection path. Adds AddKeyedRefitGeneratedClient<T> on IServiceCollection mirroring all five AddRefitGeneratedClient<T> overloads with a leading serviceKey. The client and its SettingsFor<T> register as keyed services, the underlying HttpClient name defaults to UniqueName.ForType<T>(serviceKey), and handler composition follows AddKeyedRefitClient so both keyed paths behave alike. No reflection fallback and no RequiresUnreferencedCode annotation. Purely additive. * Remove note changes in breaking-changes since it is not really breaking
fix(generator): support path and header bindings (#2281) - Preserve path binding when a parameter also contributes a dynamic header. - Add live regressions and GCVerbose generator/runtime benchmarks. - Isolate analyzer white-box tests from the public analyzer test assembly.
build: update NuGet dependencies (#2276) * chore: update refit file * build: update NuGet dependencies - Upgrade TUnit, ASP.NET Core 8, and SonarAnalyzer to current compatible releases. - Resolve new diagnostics and add direct tests for complete line and branch coverage.
PreviousNext