Open
Conversation
Delete the local Claude settings file that contained a large list of allowed Bash commands. This file is environment-specific and potentially exposes permissions; removing it cleans up the repository and prevents committing local config. Consider adding this path to .gitignore if it should remain local.
- Update TargetFramework to net10.0 in both project files - Upgrade all .NET-versioned packages to 10.0.x - Remove redundant System.Text.Json (built into .NET 10) - Update global.json SDK to 10.0.103 - Update CI workflow dotnet-version from 8.x to 10.x - Regenerate packages.lock.json for .NET 10 Fix analyzer warnings introduced by .NET 10 analyzers: - Remove public partial class Program (ASP0027: no longer needed) - Migrate ILogger calls to [LoggerMessage] source generation (CA1873) - Suppress CA1873 false positive in Moq.Verify lambda in tests - Fix SA1204: move static LoggerMessage methods before instance methods Fix pre-commit hook for .NET 10 compatibility: - Replace dotnet format (full) with dotnet format whitespace to avoid MSB4018 file lock errors caused by the internal build that dotnet format triggers conflicting with the subsequent Release build - The Release build still validates all analyzer rules as warnings Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Update TargetFramework from net8.0 to net10.0
- Upgrade all Microsoft.* packages to 10.0.x versions
- Remove explicit System.Text.Json dependency (built into .NET 10)
- Update global.json SDK to 10.0.103
- Update CI workflow to use dotnet-version: 10.x
- Regenerate packages.lock.json for .NET 10
- Remove public partial class Program {} (fixes ASP0027)
- Migrate ILogger calls to [LoggerMessage] source generation (fixes CA1873)
- Suppress CA1873 false positive in test mock verification
- Regenerate packages.lock.json with updated dependencies
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR upgrades the C# LampControlApi solution to .NET 10, updating core framework targets, package references/lock files, and CI/pre-commit tooling to align with the new runtime and analyzers.
Changes:
- Retarget projects from
net8.0tonet10.0and refresh NuGet dependencies/lock file accordingly. - Update logging in
PostgresLampRepositoryto use[LoggerMessage]source generation (CA1873-related). - Adjust CI matrix to .NET
10.xand tweak pre-commit formatting to usedotnet format whitespace.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/csharp/LampControlApi/packages.lock.json | Regenerated lock file for net10.0 dependency graph. |
| src/csharp/LampControlApi/global.json | Pins SDK version to 10.0.103 (but see comment about discovery from CI/scripts). |
| src/csharp/LampControlApi/Services/PostgresLampRepository.cs | Migrates debug logs to [LoggerMessage] source-generated logging methods. |
| src/csharp/LampControlApi/Program.cs | Removes explicit public partial class Program block. |
| src/csharp/LampControlApi/LampControlApi.csproj | Retargets to net10.0, updates package versions, removes explicit System.Text.Json. |
| src/csharp/LampControlApi.Tests/LampControllerImplementationTests.cs | Modernizes MSTest Assert.IsInstanceOfType usage. |
| src/csharp/LampControlApi.Tests/LampControlApi.Tests.csproj | Retargets to net10.0 and updates test-time ASP.NET/EF packages. |
| src/csharp/LampControlApi.Tests/Infrastructure/PostgresLampRepositoryUnitTests.cs | Adds CA1873 suppression around Moq logger verification. |
| src/csharp/LampControlApi.Tests/Infrastructure/LampControlDbContextTests.cs | Modernizes MSTest Assert.IsInstanceOfType usage. |
| scripts/hooks/csharp.sh | Switches pre-commit formatting to dotnet format whitespace. |
| .github/workflows/csharp-ci.yml | Updates CI to run on .NET 10.x. |
| .claude/settings.local.json | Removes local Claude settings file from repo. |
- Move global.json from LampControlApi/ to src/csharp/ so the SDK pin is discovered by dotnet CLI when running from src/csharp/ (CI/scripts) - Enable RestorePackagesWithLockFile in test project and commit generated packages.lock.json, fixing missing cache-dependency-path in CI - Fix indentation of Npgsql.EntityFrameworkCore.PostgreSQL PackageReference Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Upgrade Swashbuckle.AspNetCore 6.6.2 → 10.1.4: the old version's SwaggerGenerator did not implement the updated ISwaggerProvider.GetSwagger interface added in .NET 10, causing TypeLoadException in all tests that spin up the WebApplication host - Fix Operations_ShouldLogDebugMessages: [LoggerMessage] source-generated methods call ILogger.IsEnabled() before Log(); since Moq returns false by default the log calls were short-circuited. Added mockLogger.Setup(l => l.IsEnabled(LogLevel.Debug)).Returns(true) in TestInitialize so Log() is actually invoked - Regenerate packages.lock.json for both projects Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…class Swashbuckle 10.x derives the swagger operation tag by stripping the "Controller" suffix from the class name. The NSwag-generated class is literally named "Controller", so stripping the suffix yields an empty string and throws ArgumentNullException (referenceId) when generating the swagger document. Override TagActionsBy in AddSwaggerGen to fall back to "Lamps" when the route controller value is empty, so /swagger/v1/swagger.json returns 200. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TargetFrameworkfromnet8.0tonet10.0Microsoft.*packages to10.0.xversionsSystem.Text.Jsonpackage reference (now built into .NET 10)global.jsonSDK to10.0.103dotnet-version: 10.xpackages.lock.jsonfor .NET 10ASP0027: remove redundantpublic partial class Program {}CA1873: migrateILoggercalls to[LoggerMessage]source generation inPostgresLampRepositorydotnet format whitespaceinstead ofdotnet formatto avoid MSBuild file lock contention (MSB4018) during commitsTest plan
dotnet build --configuration Releasepassesdotnet testpassesdotnet format whitespace --verify-no-changespasses🤖 Generated with Claude Code