Skip to content

[migration] Migrate project to SDK 10 and fix deprecations#284

Merged
marwannettour merged 13 commits intomasterfrom
283-feature-infrastructure-migration-to-sdk-v100
Apr 8, 2026
Merged

[migration] Migrate project to SDK 10 and fix deprecations#284
marwannettour merged 13 commits intomasterfrom
283-feature-infrastructure-migration-to-sdk-v100

Conversation

@marwannettour
Copy link
Copy Markdown
Collaborator

@marwannettour marwannettour commented Apr 2, 2026

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.0net10.0)

Project Type
ByteSync.Client Desktop app (Avalonia)
ByteSync.Common Shared business logic
ByteSync.Functions Azure Functions isolated-worker host
ByteSync.ServerCommon Server-side services
ByteSync.Client.UnitTests Unit tests
ByteSync.Client.IntegrationTests Integration tests
ByteSync.Common.Tests Tests
ByteSync.Functions.UnitTests Tests
ByteSync.Functions.IntegrationTests Tests
ByteSync.ServerCommon.Tests Tests
ByteSync.TestsCommon Shared test infrastructure

NuGet package upgrades

All Microsoft packages that are versioned alongside the runtime were updated to their .NET 10 equivalents:

Package Old version New version
Microsoft.AspNetCore.Authentication.JwtBearer 8.0.23 10.0.5
Microsoft.AspNetCore.SignalR.Client 8.0.23 10.0.5
Microsoft.Extensions.Configuration / .Json 8.0.x 10.0.5
Microsoft.Extensions.DependencyInjection 8.0.1 10.0.5
Microsoft.Extensions.Http 8.0.1 10.0.5
Microsoft.Extensions.Logging.Abstractions 8.0.3 10.0.5
Microsoft.Azure.Functions.Worker 1.24.0 2.51.0
Microsoft.Azure.Functions.Worker.Sdk 1.18.1 2.0.7
Microsoft.Azure.Functions.Worker.ApplicationInsights 1.4.0 2.50.0
Microsoft.Azure.AppConfiguration.AspNetCore 8.1.2 8.5.0
Microsoft.Azure.SignalR / .Management 1.32.0 1.33.0

Breaking change adaptations (Azure Functions Worker v2 API)

The WriteAsJsonAsync overload that accepted an explicit HttpStatusCode argument 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 call WriteAsJsonAsync without the status parameter.

Files updated:

  • src/ByteSync.Functions/Http/AuthFunction.cs
  • src/ByteSync.Functions/Http/AnnouncementFunction.cs
  • src/ByteSync.Functions/Http/CloudSessionFunction.cs
  • src/ByteSync.Functions/Http/CloudSessionProfileFunction.cs
  • src/ByteSync.Functions/Http/FileTransferFunction.cs
  • src/ByteSync.Functions/Http/InventoryFunction.cs
  • src/ByteSync.Functions/Http/LobbyFunction.cs
  • src/ByteSync.Functions/Http/SessionMemberFunction.cs
  • src/ByteSync.Functions/Http/TrustFunction.cs
  • src/ByteSync.Functions/Helpers/Middlewares/JwtMiddleware.cs

🧪 How to Test?

  1. Fetch the branch:
    git fetch && git checkout 283-feature-infrastructure-migration-to-sdk-v100
    
  2. Ensure .NET 10 SDK is installed:
    dotnet --version   # should print 10.x.x
    
  3. Build the solution:
    dotnet build ByteSync.sln
    
  4. Run the full test suite:
    dotnet test ByteSync.sln
    
  5. Start the Azure Functions host locally and verify endpoints respond correctly (authentication, session creation, file transfer).

📌 Additional Notes

  • The Microsoft.Extensions.Http.Polly package (8.0.22) was intentionally left at its current version as no .NET 10-specific release is yet available; it remains compatible.
  • The Azure Functions isolated-worker model is fully supported on .NET 10 via the 2.x SDK and Worker packages.
  • No public API surface changes were introduced; all adaptations are internal to the HTTP response handling layer.

@marwannettour marwannettour linked an issue Apr 2, 2026 that may be closed by this pull request
@marwannettour marwannettour changed the title [ADD] SDK 8.0 --> SDK 10 [migration] Migrate project to SDK 10 and fix deprecations Apr 3, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.0 to net10.0 and 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 WriteAsJsonAsync usage 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.

Comment on lines 20 to +24
<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"/>
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

done in commit f53a5ee

Comment on lines 16 to +20
<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" />
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

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

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).

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

done in commit f53a5ee

@@ -32,7 +32,7 @@ public async Task<HttpResponseData> StartTrustCheck(
var result = await _mediator.Send(request);

var response = req.CreateResponse();
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
var response = req.CreateResponse();
var response = req.CreateResponse();
response.StatusCode = HttpStatusCode.OK;

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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;
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
using ByteSync.Common.Business.EndPoints;

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

done in commit f53a5ee

Comment on lines +21 to +40
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;
}
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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

paul-fresquet
paul-fresquet previously approved these changes Apr 7, 2026
Copy link
Copy Markdown
Contributor

@paul-fresquet paul-fresquet left a comment

Choose a reason for hiding this comment

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

Good Job 👍

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 7, 2026

@marwannettour marwannettour merged commit f7b0501 into master Apr 8, 2026
25 checks passed
@marwannettour marwannettour deleted the 283-feature-infrastructure-migration-to-sdk-v100 branch April 8, 2026 08:16
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.

[feature] Infrastructure migration to SDK v10.0

3 participants