Skip to content

Upgrade from .NET 7 to .NET 9 - #71

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1787756695-dotnet9-upgrade
Open

devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1787756695-dotnet9-upgrade

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Aug 26, 2026

Copy link
Copy Markdown

Summary

Modernizes the solution from .NET 7 (EOL) to .NET 9:

  • All 6 projects: <TargetFramework>net7.0</TargetFramework>net9.0
  • EF Core / Npgsql packages 7.x → 9.x (Microsoft.EntityFrameworkCore* 9.0.8, Npgsql 9.0.3, Npgsql.EntityFrameworkCore.PostgreSQL[.NodaTime] 9.0.4)
  • WebApi: Microsoft.AspNetCore.OpenApi 9.0.8, AspNetCore.HealthChecks.NpgSql 9.0.0, Swashbuckle.AspNetCore 7.2.0
  • Test projects: xunit 2.9.2, Test SDK 17.12.0, FakeItEasy 8.3.0, coverlet 6.0.2
  • Dockerfile base images aspnet:7.0/sdk:7.0 → 9.0; CI workflow dotnet-version 6.0.x → 9.0.x; README updated

No source code changes were required. Verified locally: dotnet build -c Release succeeds and all 20 tests pass on net9.0.

Link to Devin session: https://app.devin.ai/sessions/7ffd6426ff5b43388c348c0d459dd00e
Requested by: @detectiveharree


Note

Devin errored when opening this Pull Request as detectiveharree.
As a fallback, Devin opened this PR as itself.


Devin Review

Status Commit
⚪ Not started

Run Devin Review

Devin Review (Staging)

Co-Authored-By: harrison.reeves <harrisonreeves00@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Devin Review found 5 potential issues.

Devin Review

<PackageReference Include="Npgsql" Version="7.0.4" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.4" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL.NodaTime" Version="7.0.4" />
<PackageReference Include="Npgsql" Version="9.0.3" />

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🔴 Docker database requests always fail

With Npgsql 9, Docker Compose still passes the removed IntegratedSecurity option. Every database-backed API request returns an internal-server error.

Prompt for agents
The Npgsql 9 upgrade in src/Infrastructure/Infrastructure.csproj is incompatible with docker-compose.yml, whose ConnectionStrings__DefaultConnection still contains IntegratedSecurity=true. Npgsql 9 rejects that keyword before opening PostgreSQL, so EducationRepository operations fail in the documented Docker setup. Update the Compose connection string to use Npgsql 9-supported PostgreSQL keywords while preserving the existing host, port, database, username, password, and pooling settings.
Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.10">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.8" />

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🟡 Database migrations reject the model

EF Core 9 rebuilds the seeded record with a new identifier each time. Migration commands reject the resulting model as an uncommitted change.

Prompt for agents
The EF Core 9 upgrade in src/Infrastructure/Infrastructure.csproj activates pending-model-change validation, but SampleDbContext.OnModelCreating seeds Education with Guid.NewGuid(). The generated identifier never matches SampleDbContextModelSnapshot, so migration commands such as database update fail before applying migrations. Make the seeded identifier deterministic and keep it aligned with the existing migration and snapshot; verify migration creation and database update against EF Core 9.
Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment thread README.md
## ASP.NETCore Web API Sample

This repository is a sample ASP.NET Core Web API (.NET 7) project.
This repository is a sample ASP.NET Core Web API (.NET 9) project.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🔍 Upgrade guide retains .NET 7 settings

The GraphQL specification still prescribes net7.0 and 7.x packages. Following it can recreate a mixed-version solution after this upgrade.

Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment thread Dockerfile
Comment on lines +1 to +5
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
WORKDIR /app
EXPOSE 5000

FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

📝 Info: Docker build remains compatible

The .NET 9 images restore, compile, and publish the application. Existing stage paths, output locations, and the entry point remain valid.

Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +10 to +22
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.8">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.10">
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.8">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Npgsql" Version="7.0.4" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.4" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL.NodaTime" Version="7.0.4" />
<PackageReference Include="Npgsql" Version="9.0.3" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.4" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL.NodaTime" Version="9.0.4" />

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

📝 Info: Legacy migration metadata is valid

Checked-in migrations retain their EF Core 7 generation annotation. EF Core 9 accepts historical metadata, so regeneration is unnecessary for that annotation alone.

Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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.

0 participants