[migration] Migrate project to SDK 10 and fix deprecations#284
[migration] Migrate project to SDK 10 and fix deprecations#284marwannettour merged 13 commits intomasterfrom
Conversation
…onTests/ByteSync.Client.IntegrationTests.csproj)
… is correctly executed
There was a problem hiding this comment.
Pull request overview
Migrates the ByteSync solution from .NET 8 to .NET 10, updates runtime-aligned Microsoft NuGet packages, and adapts Azure Functions isolated-worker HTTP response writing for the newer worker SDK.
Changes:
- Bump all projects (apps/libs/tests) from
net8.0tonet10.0and update CI to use .NET 10. - Upgrade Microsoft runtime-coupled packages (e.g.,
Microsoft.Extensions.*,JwtBearer,SignalR.Client) and Azure Functions Worker packages. - Update Azure Functions HTTP handlers to the newer
WriteAsJsonAsyncusage pattern; add/expand unit tests for several HTTP functions.
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/ByteSync.TestsCommon/ByteSync.TestsCommon.csproj | Move test common project to net10.0; update SignalR.Client package. |
| tests/ByteSync.ServerCommon.Tests/ByteSync.ServerCommon.Tests.csproj | Move to net10.0; bump Microsoft.Extensions.* test dependencies. |
| tests/ByteSync.Functions.UnitTests/Http/TrustFunctionTests.cs | Expand coverage and standardize request-body writing helper in tests. |
| tests/ByteSync.Functions.UnitTests/Http/InventoryFunctionTests.cs | New unit tests for InventoryFunction HTTP endpoints. |
| tests/ByteSync.Functions.UnitTests/Http/FileTransferFunctionTests.cs | New unit tests for FileTransferFunction HTTP endpoints. |
| tests/ByteSync.Functions.UnitTests/Http/CloudSessionProfileFunctionTests.cs | New unit tests for CloudSessionProfileFunction HTTP endpoints. |
| tests/ByteSync.Functions.UnitTests/ByteSync.Functions.UnitTests.csproj | Move Functions unit tests to net10.0; bump Microsoft packages. |
| tests/ByteSync.Functions.IntegrationTests/End2End/E2E_Environment_Setup.cs | Update Functions container image tag for E2E tests. |
| tests/ByteSync.Functions.IntegrationTests/ByteSync.Functions.IntegrationTests.csproj | Move integration tests to net10.0; bump Microsoft.Extensions.*. |
| tests/ByteSync.Common.Tests/ByteSync.Common.Tests.csproj | Move common tests project to net10.0. |
| tests/ByteSync.Client.UnitTests/ByteSync.Client.UnitTests.csproj | Move client unit tests project to net10.0. |
| tests/ByteSync.Client.IntegrationTests/ByteSync.Client.IntegrationTests.csproj | Move client integration tests to net10.0; bump Microsoft.Extensions.*. |
| src/ByteSync.ServerCommon/ByteSync.ServerCommon.csproj | Move to net10.0; bump ASP.NET Core + Extensions + SignalR packages. |
| src/ByteSync.Functions/Http/TrustFunction.cs | Remove deprecated WriteAsJsonAsync(..., HttpStatusCode) overload usage. |
| src/ByteSync.Functions/Http/SessionMemberFunction.cs | Remove deprecated WriteAsJsonAsync(..., HttpStatusCode) overload usage. |
| src/ByteSync.Functions/Http/LobbyFunction.cs | Remove deprecated WriteAsJsonAsync(..., HttpStatusCode) overload usage. |
| src/ByteSync.Functions/Http/InventoryFunction.cs | Remove deprecated WriteAsJsonAsync(..., HttpStatusCode) overload usage. |
| src/ByteSync.Functions/Http/FileTransferFunction.cs | Remove deprecated WriteAsJsonAsync(..., HttpStatusCode) overload usage. |
| src/ByteSync.Functions/Http/CloudSessionProfileFunction.cs | Remove deprecated WriteAsJsonAsync(..., HttpStatusCode) overload usage. |
| src/ByteSync.Functions/Http/CloudSessionFunction.cs | Remove deprecated WriteAsJsonAsync(..., HttpStatusCode) overload usage. |
| src/ByteSync.Functions/Http/AuthFunction.cs | Adapt unauthorized responses to set StatusCode explicitly before JSON write. |
| src/ByteSync.Functions/Http/AnnouncementFunction.cs | Remove deprecated WriteAsJsonAsync(..., HttpStatusCode) overload usage. |
| src/ByteSync.Functions/Helpers/Middlewares/JwtMiddleware.cs | Remove deprecated WriteAsJsonAsync(..., HttpStatusCode) overload usage in middleware error path. |
| src/ByteSync.Functions/ByteSync.Functions.csproj | Move Functions host to net10.0; bump Worker v2 and Microsoft packages. |
| src/ByteSync.Common/ByteSync.Common.csproj | Move shared library to net10.0; bump logging abstractions. |
| src/ByteSync.Client/ByteSync.Client.csproj | Move client app to net10.0; bump Extensions/SignalR packages. |
| .github/workflows/trigger-PR-pipeline.yml | Update GitHub Actions pipeline to install .NET 10 SDK. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Timer" Version="4.3.1" /> | ||
| <PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.18.1" /> | ||
| <PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="2.0.7" /> | ||
| <PackageReference Include="Microsoft.Azure.AppConfiguration.AspNetCore" Version="8.1.2" /> | ||
| <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.23"/> | ||
| <PackageReference Include="Microsoft.Azure.SignalR" Version="1.32.0"/> | ||
| <PackageReference Include="Microsoft.Azure.SignalR.Management" Version="1.32.0"/> | ||
| <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" /> | ||
| <PackageReference Include="Microsoft.Extensions.Http" Version="8.0.1" /> | ||
| <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.3" /> | ||
| <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="10.0.5"/> | ||
| <PackageReference Include="Microsoft.Azure.SignalR" Version="1.33.0"/> |
There was a problem hiding this comment.
PR description says Microsoft.Azure.AppConfiguration.AspNetCore was upgraded to 8.5.0, but this project still references 8.1.2. Either bump this PackageReference to the intended version or adjust the PR description/table so it matches the actual upgrade set.
| <PackageReference Include="FakeItEasy" Version="8.3.0" /> | ||
| <PackageReference Include="AwesomeAssertions" Version="8.0.1" /> | ||
| <PackageReference Include="Microsoft.Azure.AppConfiguration.AspNetCore" Version="8.4.0"/> | ||
| <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" /> | ||
| <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.3" /> | ||
| <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.5" /> | ||
| <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.5" /> |
There was a problem hiding this comment.
PR description says Microsoft.Azure.AppConfiguration.AspNetCore was upgraded to 8.5.0, but this test project still references 8.4.0. Please align the version with the intended upgrade set (or update the PR description if 8.4.0 is intentional).
| @@ -32,7 +32,7 @@ public async Task<HttpResponseData> StartTrustCheck( | |||
| var result = await _mediator.Send(request); | |||
|
|
|||
| var response = req.CreateResponse(); | |||
There was a problem hiding this comment.
In this handler the status code is no longer explicitly set after removing the WriteAsJsonAsync(HttpStatusCode) overload. If the intent is to follow the new pattern described in the PR (set StatusCode explicitly, then WriteAsJsonAsync), consider setting response.StatusCode = HttpStatusCode.OK before serializing for consistency with the other Trust endpoints.
| var response = req.CreateResponse(); | |
| var response = req.CreateResponse(); | |
| response.StatusCode = HttpStatusCode.OK; |
There was a problem hiding this comment.
You're right, I missed this one. The fix has been pushed: response.StatusCode is now explicitly set to HttpStatusCode.OK prior to serialization, perfectly matching the other Trust endpoints.
| using ByteSync.Common.Business.Trust.Connections; | ||
| using ByteSync.Common.Business.Versions; | ||
| using ByteSync.Common.Controls.Json; | ||
| using ByteSync.Common.Business.EndPoints; |
There was a problem hiding this comment.
This using appears to be unused in the file, which adds noise and can generate CS8019 warnings during build. Please remove it if it’s not needed.
| using ByteSync.Common.Business.EndPoints; |
| private static FunctionContext BuildFunctionContextWithClient() | ||
| { | ||
| var mockContext = new Mock<FunctionContext>(); | ||
| var items = new Dictionary<object, object>(); | ||
| mockContext.SetupGet(c => c.Items).Returns(items); | ||
|
|
||
| var client = new Client("cli", "cliInst", "1.0.0", OSPlatforms.Windows, "127.0.0.1"); | ||
| items[AuthConstants.FUNCTION_CONTEXT_CLIENT] = client; | ||
|
|
||
| return mockContext.Object; | ||
| } | ||
|
|
||
| private static async Task WriteBodyAsync<T>(FakeHttpRequestData request, T body) | ||
| { | ||
| var json = JsonHelper.Serialize(body); | ||
| var bytes = Encoding.UTF8.GetBytes(json); | ||
| request.Body.SetLength(0); | ||
| await request.Body.WriteAsync(bytes, 0, bytes.Length); | ||
| request.Body.Position = 0; | ||
| } |
There was a problem hiding this comment.
BuildFunctionContextWithClient and WriteBodyAsync are duplicated across multiple HTTP function test classes. Consider moving these helpers into a shared test utility (e.g., under TestHelpers) to reduce repetition and make future updates (like serializer/body handling changes) less error-prone.
There was a problem hiding this comment.
Great suggestion. I've extracted both BuildFunctionContextWithClient and WriteBodyAsync into a new shared HttpFunctionTestHelper class. I then refactored all HTTP function test classes (Trust, Inventory, Lobby, etc.) to use this centralized utility, which significantly reduces code duplication
|



Description
Upgrades the entire ByteSync solution from .NET 8 to .NET 10, bringing in the latest runtime features, performance improvements, and long-term support.
All four library/application projects and all six test projects are updated in a single atomic change so the solution remains consistently targeted.
🛠️ Changes Made
Target framework bump (
net8.0→net10.0)ByteSync.ClientByteSync.CommonByteSync.FunctionsByteSync.ServerCommonByteSync.Client.UnitTestsByteSync.Client.IntegrationTestsByteSync.Common.TestsByteSync.Functions.UnitTestsByteSync.Functions.IntegrationTestsByteSync.ServerCommon.TestsByteSync.TestsCommonNuGet package upgrades
All Microsoft packages that are versioned alongside the runtime were updated to their .NET 10 equivalents:
Microsoft.AspNetCore.Authentication.JwtBearerMicrosoft.AspNetCore.SignalR.ClientMicrosoft.Extensions.Configuration/.JsonMicrosoft.Extensions.DependencyInjectionMicrosoft.Extensions.HttpMicrosoft.Extensions.Logging.AbstractionsMicrosoft.Azure.Functions.WorkerMicrosoft.Azure.Functions.Worker.SdkMicrosoft.Azure.Functions.Worker.ApplicationInsightsMicrosoft.Azure.AppConfiguration.AspNetCoreMicrosoft.Azure.SignalR/.ManagementBreaking change adaptations (Azure Functions Worker v2 API)
The
WriteAsJsonAsyncoverload that accepted an explicitHttpStatusCodeargument was removed in the Azure Functions Worker v2 SDK. All affected HTTP function handlers were updated to the new pattern: set the status code on the response object separately, then callWriteAsJsonAsyncwithout the status parameter.Files updated:
src/ByteSync.Functions/Http/AuthFunction.cssrc/ByteSync.Functions/Http/AnnouncementFunction.cssrc/ByteSync.Functions/Http/CloudSessionFunction.cssrc/ByteSync.Functions/Http/CloudSessionProfileFunction.cssrc/ByteSync.Functions/Http/FileTransferFunction.cssrc/ByteSync.Functions/Http/InventoryFunction.cssrc/ByteSync.Functions/Http/LobbyFunction.cssrc/ByteSync.Functions/Http/SessionMemberFunction.cssrc/ByteSync.Functions/Http/TrustFunction.cssrc/ByteSync.Functions/Helpers/Middlewares/JwtMiddleware.cs🧪 How to Test?
📌 Additional Notes
Microsoft.Extensions.Http.Pollypackage (8.0.22) was intentionally left at its current version as no .NET 10-specific release is yet available; it remains compatible.2.xSDK and Worker packages.