Skip to content

Remove Microsoft.AspNetCore.Http dependency#42

Merged
davidkallesen merged 5 commits into
mainfrom
hotfix/Remove-Microsoft-AspNetCore-Http
Feb 19, 2026
Merged

Remove Microsoft.AspNetCore.Http dependency#42
davidkallesen merged 5 commits into
mainfrom
hotfix/Remove-Microsoft-AspNetCore-Http

Conversation

@davidkallesen

Copy link
Copy Markdown
Collaborator

Removing Microsoft.AspNetCore.Http from Atc.Rest.Client

Motivation

Atc.Rest.Client targets netstandard2.0, which should make it usable from Blazor WebAssembly.
However, the package reference to Microsoft.AspNetCore.Http (v2.3.9) prevents this because
Microsoft.AspNetCore.Http is not compatible with the browser sandbox (it depends on server-side
primitives that do not exist in WASM).

Removing this dependency would allow Atc.Rest.Client to be used in:

  • Blazor WebAssembly (client-side)
  • .NET MAUI / Xamarin
  • Any other environment where ASP.NET Core server packages are unavailable

@davidkallesen davidkallesen force-pushed the hotfix/Remove-Microsoft-AspNetCore-Http branch from 28b17d1 to 35ac4e2 Compare February 19, 2026 12:56
@perkops perkops requested a review from Copilot February 19, 2026 19:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR removes the Microsoft.AspNetCore.Http dependency from Atc.Rest.Client (netstandard2.0) to enable use in browser-sandboxed and non-ASP.NET environments (e.g., Blazor WASM, MAUI), while keeping file upload support via a new IFileContent abstraction plus reflection-based “duck typing”.

Changes:

  • Remove Microsoft.AspNetCore.Http usage and introduce IFileContent + reflection wrapper to support file-like inputs without ASP.NET Core packages.
  • Add/adjust unit tests for the new file upload behavior and update README documentation.
  • Bump several package/analyzer versions and add a custom analyzer rule setting.

Reviewed changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
test/Directory.Build.props Bumps Atc.Test package version used by tests.
test/Atc.Rest.Client.Tests/Serialization/JsonSerializerOptionsExtensionsTests.cs Cleans up usings/formatting; relies on global Json serialization usings.
test/Atc.Rest.Client.Tests/GlobalUsings.cs Adds System.Text.Json.Serialization as a test global using.
test/Atc.Rest.Client.Tests/Builder/MessageResponseBuilderStreamingTests.cs Formatting-only changes to method signatures.
test/Atc.Rest.Client.Tests/Builder/MessageResponseBuilderBinaryTests.cs Formatting-only changes to method signatures.
test/Atc.Rest.Client.Tests/Builder/MessageRequestBuilderTests.cs Formatting changes; no behavioral change indicated.
test/Atc.Rest.Client.Tests/Builder/MessageRequestBuilderMultipartTests.cs Minor formatting change in test helper.
test/Atc.Rest.Client.Tests/Builder/MessageRequestBuilderFileContentTests.cs New tests covering IFileContent and duck-typed file-like objects.
test/Atc.Rest.Client.Tests/Builder/MessageRequestBuilderAdditionalTests.cs Minor formatting change in test helper.
test/Atc.Rest.Client.Tests/Builder/HttpMessageFactoryTests.cs Formatting-only changes to method signature.
test/Atc.Rest.Client.Tests/Atc.Rest.Client.Tests.csproj Bumps Microsoft.Extensions.DependencyInjection package version for tests.
src/Directory.Build.props Bumps SourceLink version.
src/Atc.Rest.Client/Serialization/IContractSerializer.cs Formatting-only signature changes.
src/Atc.Rest.Client/Serialization/DefaultJsonContractSerializer.cs Formatting-only signature changes.
src/Atc.Rest.Client/RestClientDeserializationException.cs Formatting-only constructor wrapping.
src/Atc.Rest.Client/IFileContent.cs Adds new IFileContent interface for file uploads via WithBody().
src/Atc.Rest.Client/GlobalUsings.cs Removes global using of Microsoft.AspNetCore.Http.
src/Atc.Rest.Client/Builder/ReflectedFileContent.cs Adds internal wrapper to treat file-like objects as IFileContent via reflection.
src/Atc.Rest.Client/Builder/MessageResponseBuilder.cs Formatting-only signature changes.
src/Atc.Rest.Client/Builder/MessageRequestBuilder.cs Replaces IFormFile handling with IFileContent + reflection-based wrapping.
src/Atc.Rest.Client/Builder/IMessageResponseBuilder.cs Formatting-only signature changes.
src/Atc.Rest.Client/Builder/IMessageRequestBuilder.cs Formatting-only signature changes.
src/Atc.Rest.Client/Builder/IHttpMessageFactory.cs Formatting-only signature changes.
src/Atc.Rest.Client/Builder/HttpMessageFactory.cs Formatting-only signature changes.
src/Atc.Rest.Client/Atc.Rest.Client.csproj Removes Microsoft.AspNetCore.Http package reference; bumps dependency versions.
README.md Documents IFileContent and duck-typed file uploads with WithBody().
Directory.Build.props Updates analyzers; adds Atc.Analyzer PackageReference.
.editorconfig Adds configuration for custom analyzer rule ATC210.max_line_length.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Atc.Rest.Client/Builder/ReflectedFileContent.cs Outdated
Comment thread README.md Outdated
Comment thread Directory.Build.props Outdated
Comment thread src/Atc.Rest.Client/Builder/MessageRequestBuilder.cs
  - Fix trailing space in Atc.Analyzer package reference
  - Fix undefined variable in README IFileContent example
  - Improve ReflectedFileContent to handle IBrowserFile's maxAllowedSize parameter
  - Replace BinaryReader with MemoryStream copy for non-seekable streams
@davidkallesen davidkallesen merged commit f7a0747 into main Feb 19, 2026
4 checks passed
@davidkallesen davidkallesen deleted the hotfix/Remove-Microsoft-AspNetCore-Http branch February 19, 2026 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants