Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Upgrade to .NET9 #1447

Merged
merged 7 commits into from
Nov 14, 2024
Merged

chore: Upgrade to .NET9 #1447

merged 7 commits into from
Nov 14, 2024

Conversation

oskogstad
Copy link
Collaborator

@oskogstad oskogstad commented Nov 13, 2024

No description provided.

Copy link
Contributor

coderabbitai bot commented Nov 13, 2024

📝 Walkthrough

Walkthrough

This pull request updates various project files and configurations to support .NET 9.0. Changes include modifying the target framework in Directory.Build.props, updating SDK versions in global.json, and upgrading numerous package references across multiple project files. Additionally, Dockerfiles have been adjusted to use the new .NET 9.0 base images. These updates aim to ensure compatibility with the latest .NET features and enhancements.

Changes

File Change Summary
Directory.Build.props Updated <TargetFramework> from net8.0 to net9.0.
global.json Updated SDK version from 8.0.403 to 9.0.100.
src/Digdir.Domain.Dialogporten.Application/Digdir.Domain.Dialogporten.Application.csproj Updated package references: HtmlAgilityPack from 1.11.70 to 1.11.71, Microsoft.Extensions.Hosting from 8.0.1 to 9.0.0, Microsoft.Extensions.Options.ConfigurationExtensions from 8.0.0 to 9.0.0.
src/Digdir.Domain.Dialogporten.ChangeDataCapture/Digdir.Domain.Dialogporten.ChangeDataCapture.csproj Added package references: System.Text.Json version 9.0.0, System.Drawing.Common version 9.0.0.
src/Digdir.Domain.Dialogporten.ChangeDataCapture/Dockerfile Updated base image from 8.0.10 to 9.0.0 and SDK image from 8.0.403 to 9.0.100.
src/Digdir.Domain.Dialogporten.ChangeDataCapture/Outbox/OutboxReplicationMapper.cs Updated method parameter type from IReadOnlyDictionary<string, object?> to Dictionary<string, object?>.
src/Digdir.Domain.Dialogporten.GraphQL/Digdir.Domain.Dialogporten.GraphQL.csproj Updated package references: Microsoft.AspNetCore.Authentication.JwtBearer from 8.0.10 to 9.0.0, added Microsoft.IdentityModel.JsonWebTokens at 8.2.0, System.Drawing.Common at 9.0.0, and System.IdentityModel.Tokens.Jwt at 8.2.0.
src/Digdir.Domain.Dialogporten.GraphQL/Dockerfile Updated base image from 8.0.10 to 9.0.0 and SDK image from 8.0.403 to 9.0.100.
src/Digdir.Domain.Dialogporten.Infrastructure/Digdir.Domain.Dialogporten.Infrastructure.csproj Updated package references: Microsoft.Extensions.Caching.StackExchangeRedis from 8.0.10 to 9.0.0, added Microsoft.IdentityModel.JsonWebTokens at 8.2.0, System.Text.Json at 9.0.0, and System.IdentityModel.Tokens.Jwt at 8.2.0.
src/Digdir.Domain.Dialogporten.Infrastructure/MigrationBundle.dockerfile Updated base image from 8.0.10 to 9.0.0 and SDK image from 8.0.403 to 9.0.100.
src/Digdir.Domain.Dialogporten.Janitor/Digdir.Domain.Dialogporten.Janitor.csproj Removed <TargetFramework>, updated all Microsoft.Extensions package references to version 9.0.0.
src/Digdir.Domain.Dialogporten.Janitor/Dockerfile Updated base image from 8.0.10 to 9.0.0 and SDK image from 8.0.403 to 9.0.100.
src/Digdir.Domain.Dialogporten.Service/Dockerfile Updated base image from 8.0.10 to 9.0.0 and SDK image from 8.0.403 to 9.0.100.
src/Digdir.Domain.Dialogporten.WebApi/Digdir.Domain.Dialogporten.WebApi.csproj Updated package references: Microsoft.AspNetCore.Authentication.JwtBearer, Microsoft.AspNetCore.Mvc.NewtonsoftJson, Microsoft.AspNetCore.OpenApi from 8.0.10 to 9.0.0, added Microsoft.IdentityModel.JsonWebTokens at 8.2.0 and System.IdentityModel.Tokens.Jwt at 8.2.0.
src/Digdir.Domain.Dialogporten.WebApi/Dockerfile Updated base image from 8.0.10 to 9.0.0 and SDK image from 8.0.403 to 9.0.100.
src/Digdir.Library.Utils.AspNet/Digdir.Library.Utils.AspNet.csproj Updated Microsoft.Extensions.Http from 8.0.1 to 9.0.0, added System.Text.Json at 9.0.0, System.Drawing.Common at 9.0.0, and updated OpenTelemetry from 1.9.0 to 1.10.0.
src/Digdir.Tool.Dialogporten.SlackNotifier/Digdir.Tool.Dialogporten.SlackNotifier.csproj Updated Microsoft.Azure.Functions.Worker from 1.23.0 to 2.0.0, Microsoft.Azure.Functions.Worker.Sdk from 1.18.1 to 2.0.0, and Microsoft.Extensions.Configuration.UserSecrets from 8.0.1 to 9.0.0. Added System.Text.Json at 9.0.0.
tests/Digdir.Domain.Dialogporten.Application.Integration.Tests/Digdir.Domain.Dialogporten.Application.Integration.Tests.csproj Added package references: Microsoft.IdentityModel.JsonWebTokens at 8.2.0, System.IdentityModel.Tokens.Jwt at 8.2.0, System.Drawing.Common at 9.0.0, System.Formats.Asn1 at 9.0.0.
tests/Digdir.Domain.Dialogporten.Application.Unit.Tests/Digdir.Domain.Dialogporten.Application.Unit.Tests.csproj Updated Verify.Xunit from 28.1.3 to 28.2.1.
tests/Digdir.Domain.Dialogporten.Architecture.Tests/Digdir.Domain.Dialogporten.Architecture.Tests.csproj Removed properties: <TargetFramework>, <ImplicitUsings>, <Nullable>, updated Microsoft.Build from 17.11.4 to 17.12.6.
tests/Digdir.Domain.Dialogporten.GraphQl.Integration.Tests/Digdir.Domain.Dialogporten.GraphQl.Integration.Tests.csproj Updated Microsoft.AspNetCore.Mvc.Testing from 8.0.10 to 9.0.0, updated Verify.Xunit from 28.2.0 to 28.2.1.
tests/Digdir.Domain.Dialogporten.GraphQl.Unit.Tests/Digdir.Domain.Dialogporten.GraphQl.Unit.Tests.csproj Removed properties: <TargetFramework>, <ImplicitUsings>, <Nullable>.
tests/Digdir.Domain.Dialogporten.WebApi.Integration.Tests/Digdir.Domain.Dialogporten.WebApi.Integration.Tests.csproj Updated Microsoft.AspNetCore.Mvc.Testing from 8.0.10 to 9.0.0, updated Verify.Xunit from 28.2.0 to 28.2.1.
tests/Digdir.Tool.Dialogporten.SlackNotifier.Tests/Digdir.Tool.Dialogporten.SlackNotifier.Tests.csproj Removed properties: <TargetFramework>, <ImplicitUsings>, <Nullable>.

Possibly related issues

  • Upgrade to .NET9 #1199: This issue requests an upgrade to .NET 9, which aligns with the objectives of this PR to upgrade all projects to .NET 9.

Possibly related PRs

Suggested reviewers

  • MagnusSandgren: Suggested for review based on expertise and involvement in related projects.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@oskogstad oskogstad changed the title (╯°□°)╯︵ ┻━┻ chore: Upgrade to .NET9 [DRAFT] Nov 13, 2024
@oskogstad oskogstad changed the title chore: Upgrade to .NET9 [DRAFT] chore: Upgrade to .NET9 Nov 13, 2024
@oskogstad oskogstad marked this pull request as ready for review November 13, 2024 15:54
@oskogstad oskogstad requested a review from a team as a code owner November 13, 2024 15:54
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🧹 Outside diff range and nitpick comments (8)
src/Digdir.Domain.Dialogporten.Infrastructure/MigrationBundle.dockerfile (2)

Line range hint 26-31: Consider security improvements in the final stage.

While the configuration looks good, consider these security improvements:

  1. Add a non-root user creation step
  2. Set appropriate file permissions for the bundle
  3. Consider using a more restrictive base image like runtime-deps instead of aspnet

Here's a suggested improvement:

 FROM base AS final
+RUN adduser --system --no-create-home --disabled-password --gecos "" appuser
 ENV Infrastructure__DialogDbConnectionString=""
 WORKDIR /app
-USER $APP_UID
 COPY --from=build /app/publish .
+RUN chown -R appuser:appuser /app
+USER appuser
 ENTRYPOINT ./efbundle -v --connection "${Infrastructure__DialogDbConnectionString}"

Line range hint 19-24: Consider caching EF Core tools installation.

The dotnet tool install command is run in every build, which could be optimized.

Consider using Docker's build cache more effectively:

 WORKDIR "/src/Digdir.Domain.Dialogporten.Infrastructure"
 RUN mkdir -p /app/publish
-RUN dotnet tool install --global dotnet-ef
+RUN dotnet tool install --global dotnet-ef --version 9.0.0
 ENV PATH $PATH:/root/.dotnet/tools
 RUN dotnet ef migrations -v bundle -o /app/publish/efbundle
src/Digdir.Domain.Dialogporten.WebApi/Dockerfile (1)

Line range hint 1-33: Consider adding HEALTHCHECK and improving security posture

While the Dockerfile follows good practices with multi-stage builds and non-root user, consider these improvements:

  1. Add a HEALTHCHECK instruction to enable container health monitoring
  2. Move the USER instruction to the base stage to ensure all created files have correct ownership

Here's how to implement these improvements:

 FROM mcr.microsoft.com/dotnet/aspnet:9.0.0@sha256:372b16214ae67e3626a5b1513ade4a530eae10c172d56ce696163b046565fa46 AS base
 WORKDIR /app
+USER $APP_UID
 EXPOSE 8080
+HEALTHCHECK --interval=30s --timeout=3s \
+  CMD curl -f http://localhost:8080/health || exit 1

 FROM mcr.microsoft.com/dotnet/sdk:9.0.100@sha256:7d24e90a392e88eb56093e4eb325ff883ad609382a55d42f17fd557b997022ca AS build
 # ... (build stage remains unchanged)

 FROM base AS final
 WORKDIR /app
-USER $APP_UID
 COPY --from=build /app/publish .
 ENTRYPOINT ["dotnet", "Digdir.Domain.Dialogporten.WebApi.dll"]
src/Digdir.Domain.Dialogporten.GraphQL/Dockerfile (1)

Line range hint 8-33: Consider adding HEALTHCHECK and earlier USER specification

The Dockerfile follows best practices with multi-stage builds and non-root user. Consider these enhancements:

  1. Add a HEALTHCHECK instruction to enable container health monitoring
  2. Move the USER instruction to the base stage for better security
 FROM mcr.microsoft.com/dotnet/aspnet:9.0.0@sha256:372b16214ae67e3626a5b1513ade4a530eae10c172d56ce696163b046565fa46 AS base
 WORKDIR /app
+USER $APP_UID
 EXPOSE 8080
+HEALTHCHECK --interval=30s --timeout=3s \
+  CMD curl -f http://localhost:8080/health || exit 1

 FROM mcr.microsoft.com/dotnet/sdk:9.0.100@sha256:7d24e90a392e88eb56093e4eb325ff883ad609382a55d42f17fd557b997022ca AS build
 # ... (build stage remains unchanged)

 FROM base AS final
 WORKDIR /app
-USER $APP_UID
 COPY --from=build /app/publish .
 ENTRYPOINT ["dotnet", "Digdir.Domain.Dialogporten.GraphQL.dll"]
tests/Digdir.Domain.Dialogporten.Architecture.Tests/Digdir.Domain.Dialogporten.Architecture.Tests.csproj (1)

Line range hint 8-17: Consider updating other test-related packages

While Microsoft.Build has been updated, other test-related packages might benefit from updates to ensure optimal compatibility with .NET 9:

  • Microsoft.NET.Test.Sdk is still on 17.11.1
  • xunit.runner.visualstudio is on 2.8.2
src/Digdir.Domain.Dialogporten.ChangeDataCapture/Outbox/OutboxReplicationMapper.cs (1)

Line range hint 47-67: Fix incorrect error message in CreatedAt validation

The error message for CreatedAt validation incorrectly states that the value "must be a Guid" instead of a date/time value.

             CreatedAt = dic[nameof(OutboxMessage.CreatedAt)] switch
             {
                 string s => DateTimeOffset.Parse(s, CultureInfo.InvariantCulture),
                 DateTime dateTime => dateTime,
                 DateTimeOffset dateTimeOffset => dateTimeOffset,
-                _ => throw new InvalidOperationException($"{nameof(OutboxMessage.CreatedAt)} must be a Guid.")
+                _ => throw new InvalidOperationException($"{nameof(OutboxMessage.CreatedAt)} must be a valid date/time value.")
             },
src/Digdir.Domain.Dialogporten.Infrastructure/Digdir.Domain.Dialogporten.Infrastructure.csproj (1)

Line range hint 3-30: Review overall package compatibility matrix

The project contains a mix of package versions:

  • .NET 9.0.0 packages
  • Identity packages at 8.2.0
  • EF Core packages at 8.0.10
  • Various third-party packages

Please ensure all packages are compatible with .NET 9 and with each other. Consider:

  1. Checking release notes for each package for .NET 9 compatibility
  2. Testing the application thoroughly after the upgrade
  3. Monitoring for any runtime warnings about package incompatibilities

Consider creating a dependency management strategy document to track:

  • Minimum supported versions
  • Version upgrade policies
  • Compatibility matrix
src/Digdir.Domain.Dialogporten.GraphQL/OpenTelemetryEventListener.cs (1)

88-89: LGTM: Consistent error handling with a potential improvement

The change maintains consistency with the updated API. However, consider consolidating the error status setting into a helper method since this pattern is repeated three times in the file.

Consider extracting the error handling pattern into a helper method:

+ private static void SetActivityError(Activity activity, Exception exception)
+ {
+     activity.AddException(exception);
+     activity.SetStatus(ActivityStatusCode.Error, exception.Message);
+ }

  public override void RequestError(IRequestContext context, Exception exception)
  {
      var currentActivity = Activity.Current;
      if (currentActivity != null)
      {
-         currentActivity.AddException(exception);
-         currentActivity.SetStatus(ActivityStatusCode.Error, exception.Message);
+         SetActivityError(currentActivity, exception);
      }
      base.RequestError(context, exception);
  }
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 9f7130b and d4f1711.

📒 Files selected for processing (25)
  • Directory.Build.props (1 hunks)
  • global.json (1 hunks)
  • src/Digdir.Domain.Dialogporten.Application/Digdir.Domain.Dialogporten.Application.csproj (1 hunks)
  • src/Digdir.Domain.Dialogporten.ChangeDataCapture/Digdir.Domain.Dialogporten.ChangeDataCapture.csproj (1 hunks)
  • src/Digdir.Domain.Dialogporten.ChangeDataCapture/Dockerfile (1 hunks)
  • src/Digdir.Domain.Dialogporten.ChangeDataCapture/Outbox/OutboxReplicationMapper.cs (1 hunks)
  • src/Digdir.Domain.Dialogporten.GraphQL/Digdir.Domain.Dialogporten.GraphQL.csproj (1 hunks)
  • src/Digdir.Domain.Dialogporten.GraphQL/Dockerfile (1 hunks)
  • src/Digdir.Domain.Dialogporten.GraphQL/OpenTelemetryEventListener.cs (3 hunks)
  • src/Digdir.Domain.Dialogporten.Infrastructure/Digdir.Domain.Dialogporten.Infrastructure.csproj (1 hunks)
  • src/Digdir.Domain.Dialogporten.Infrastructure/MigrationBundle.dockerfile (1 hunks)
  • src/Digdir.Domain.Dialogporten.Janitor/Digdir.Domain.Dialogporten.Janitor.csproj (1 hunks)
  • src/Digdir.Domain.Dialogporten.Janitor/Dockerfile (1 hunks)
  • src/Digdir.Domain.Dialogporten.Service/Dockerfile (1 hunks)
  • src/Digdir.Domain.Dialogporten.WebApi/Digdir.Domain.Dialogporten.WebApi.csproj (1 hunks)
  • src/Digdir.Domain.Dialogporten.WebApi/Dockerfile (1 hunks)
  • src/Digdir.Library.Utils.AspNet/Digdir.Library.Utils.AspNet.csproj (1 hunks)
  • src/Digdir.Tool.Dialogporten.SlackNotifier/Digdir.Tool.Dialogporten.SlackNotifier.csproj (1 hunks)
  • tests/Digdir.Domain.Dialogporten.Application.Integration.Tests/Digdir.Domain.Dialogporten.Application.Integration.Tests.csproj (1 hunks)
  • tests/Digdir.Domain.Dialogporten.Application.Unit.Tests/Digdir.Domain.Dialogporten.Application.Unit.Tests.csproj (1 hunks)
  • tests/Digdir.Domain.Dialogporten.Architecture.Tests/Digdir.Domain.Dialogporten.Architecture.Tests.csproj (1 hunks)
  • tests/Digdir.Domain.Dialogporten.GraphQl.Integration.Tests/Digdir.Domain.Dialogporten.GraphQl.Integration.Tests.csproj (1 hunks)
  • tests/Digdir.Domain.Dialogporten.GraphQl.Unit.Tests/Digdir.Domain.Dialogporten.GraphQl.Unit.Tests.csproj (0 hunks)
  • tests/Digdir.Domain.Dialogporten.WebApi.Integration.Tests/Digdir.Domain.Dialogporten.WebApi.Integration.Tests.csproj (1 hunks)
  • tests/Digdir.Tool.Dialogporten.SlackNotifier.Tests/Digdir.Tool.Dialogporten.SlackNotifier.Tests.csproj (0 hunks)
💤 Files with no reviewable changes (2)
  • tests/Digdir.Domain.Dialogporten.GraphQl.Unit.Tests/Digdir.Domain.Dialogporten.GraphQl.Unit.Tests.csproj
  • tests/Digdir.Tool.Dialogporten.SlackNotifier.Tests/Digdir.Tool.Dialogporten.SlackNotifier.Tests.csproj
✅ Files skipped from review due to trivial changes (4)
  • Directory.Build.props
  • global.json
  • src/Digdir.Domain.Dialogporten.Janitor/Dockerfile
  • tests/Digdir.Domain.Dialogporten.Application.Unit.Tests/Digdir.Domain.Dialogporten.Application.Unit.Tests.csproj
🔇 Additional comments (42)
src/Digdir.Domain.Dialogporten.ChangeDataCapture/Digdir.Domain.Dialogporten.ChangeDataCapture.csproj (1)

Line range hint 1-22: Consider updating other packages for .NET 9 compatibility

Some package versions might need updates for optimal .NET 9 compatibility:

  • Azure.Identity (current: 1.13.1)
  • MassTransit (current: 8.3.1)
  • Microsoft.Azure.AppConfiguration.AspNetCore (current: 8.0.0)

Let's check for newer versions:

#!/bin/bash
# Check latest versions from NuGet
curl -s https://api.nuget.org/v3-flatcontainer/azure.identity/index.json | jq -r '.versions[]' | tail -n 1
curl -s https://api.nuget.org/v3-flatcontainer/microsoft.azure.appconfiguration.aspnetcore/index.json | jq -r '.versions[]' | tail -n 1
curl -s https://api.nuget.org/v3-flatcontainer/masstransit/index.json | jq -r '.versions[]' | tail -n 1
tests/Digdir.Domain.Dialogporten.WebApi.Integration.Tests/Digdir.Domain.Dialogporten.WebApi.Integration.Tests.csproj (1)

9-11: Package updates look good for .NET 9!

The package version updates are appropriate for the .NET 9 upgrade:

  • Microsoft.AspNetCore.Mvc.Testing 9.0.0 matches the target .NET version
  • Verify.Xunit 28.2.1 is compatible with .NET 9

Let's verify the package compatibility matrix:

✅ Verification successful

Package updates are correctly aligned with .NET 9 upgrade

The verification confirms:

  • Target framework is properly set to net9.0 in Directory.Build.props
  • SDK version is set to 9.x in global.json
  • No remaining .NET 8 references found in project files
  • All test packages are at compatible versions for .NET 9:
    • Microsoft.AspNetCore.Mvc.Testing 9.0.0
    • Microsoft.NET.Test.Sdk 17.11.1
    • Verify.Xunit 28.2.1
    • xunit 2.9.2
    • xunit.runner.visualstudio 2.8.2
    • coverlet.collector 6.0.2
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check package compatibility with .NET 9

# Check if Directory.Build.props confirms .NET 9 upgrade
echo "Verifying target framework version:"
rg -l "<TargetFramework>net9.0</TargetFramework>" Directory.Build.props

# Check if global.json specifies .NET 9 SDK
echo "Verifying SDK version:"
rg -l "\"version\": \"9" global.json

# Look for any remaining .NET 8 references that might need updating
echo "Checking for remaining .NET 8 references:"
rg "net8" --type csproj

Length of output: 427


Script:

#!/bin/bash
# Let's try a different approach to find .NET 8 references
# First, find all .csproj files
echo "Finding all project files:"
fd -e csproj

# Then use grep directly to search for net8 in these files
echo -e "\nChecking for net8 references in project files:"
fd -e csproj -x grep -l "net8" {} \;

# Also check package versions to ensure all are aligned with .NET 9
echo -e "\nChecking package versions in the test project:"
cat tests/Digdir.Domain.Dialogporten.WebApi.Integration.Tests/Digdir.Domain.Dialogporten.WebApi.Integration.Tests.csproj

Length of output: 3848

src/Digdir.Library.Utils.AspNet/Digdir.Library.Utils.AspNet.csproj (3)

14-15: Consider cross-platform implications of System.Drawing.Common

While the version (9.0.0) aligns with .NET 9, System.Drawing.Common has known limitations:

  • It's primarily designed for Windows
  • May have reduced functionality on non-Windows platforms
  • Could impact cross-platform deployment

Consider using cross-platform alternatives like ImageSharp if image processing is needed.

Let's check if this project is used in Docker containers:

#!/bin/bash
# Search for Dockerfile references to this project
rg -l "Digdir.Library.Utils.AspNet" --type dockerfile

18-19: Align OpenTelemetry package versions

There's a version mismatch in OpenTelemetry packages:

  • OpenTelemetry is on 1.10.0
  • OpenTelemetry.Instrumentation.Runtime is on 1.9.0

It's recommended to keep OpenTelemetry packages in sync to avoid potential compatibility issues.

Let's check if a matching version exists:

#!/bin/bash
# Check NuGet for latest versions of OpenTelemetry.Instrumentation.Runtime
curl -s https://api.nuget.org/v3-flatcontainer/opentelemetry.instrumentation.runtime/index.json | jq -r '.versions[]' | sort -V | tail -n 5

12-13: Version mismatch with AspNetCore.HealthChecks.UI.Client

While Microsoft.Extensions.Http has been updated to 9.0.0, AspNetCore.HealthChecks.UI.Client remains on 8.0.1. This could lead to compatibility issues.

Let's check if a .NET 9 compatible version exists:

src/Digdir.Domain.Dialogporten.ChangeDataCapture/Dockerfile (3)

4-4: LGTM! Verify the SDK image digest.

The upgrade to .NET 9.0.100 SDK image with pinned SHA256 hash is correct and follows security best practices.

#!/bin/bash
# Description: Verify the .NET SDK image digest matches Microsoft's official registry
# Expected: The digest should match the one in the Dockerfile

docker pull mcr.microsoft.com/dotnet/sdk:9.0.100
docker image inspect mcr.microsoft.com/dotnet/sdk:9.0.100 --format '{{.RepoDigests}}'

Line range hint 8-24: Verify project references compatibility with .NET 9.

While the Dockerfile structure is correct, please ensure all referenced projects and dependencies are compatible with .NET 9:

  • Digdir.Domain.Dialogporten.Domain
  • Digdir.Library.Entity.Abstractions
✅ Verification successful

Project references are compatible with .NET 9

The Directory.Build.props file sets <TargetFramework>net9.0</TargetFramework> globally for all projects in the solution. Since this is a shared configuration file, and we can see the project references are correctly structured in the ChangeDataCapture project, the .NET 9 compatibility is properly configured across the referenced projects.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check target framework versions in referenced projects
# Expected: All projects should target net9.0

echo "Checking target frameworks in project files..."
find src -name "*.csproj" -exec grep -l "TargetFramework" {} \; | while read -r file; do
    echo "=== $file ==="
    grep -A 1 "<TargetFramework" "$file"
done

Length of output: 499


Script:

#!/bin/bash
# Let's try a different approach using ripgrep to find TargetFramework in csproj files
rg -U "<TargetFramework[^>]*>(.*?)</TargetFramework>" --type xml -g "*.csproj" -A 1

Length of output: 85


Script:

#!/bin/bash
# Also check project references in the main project file
rg -U "<ProjectReference.*?>" --type xml -g "*ChangeDataCapture.csproj"

Length of output: 290


Script:

#!/bin/bash
# Check Directory.Build.props for global framework settings
cat Directory.Build.props

Length of output: 611


1-1: LGTM! Verify the base image digest.

The upgrade to .NET 9.0.0 ASP.NET runtime image with pinned SHA256 hash is correct and follows security best practices.

✅ Verification successful

Base image upgrade is consistent and properly implemented

The verification shows that:

  • All 5 Dockerfiles in the repository consistently use the same .NET 9.0.0 runtime image with identical SHA256 hash
  • The SDK version 9.0.100 is consistently used across all Dockerfiles and matches the version in global.json
  • The upgrade has been applied uniformly across all services
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the ASP.NET runtime image digest matches Microsoft's official registry
# Expected: The digest should match the one in the Dockerfile

docker pull mcr.microsoft.com/dotnet/aspnet:9.0.0
docker image inspect mcr.microsoft.com/dotnet/aspnet:9.0.0 --format '{{.RepoDigests}}'

Length of output: 288


Script:

#!/bin/bash
# Let's verify if there are any other Dockerfiles in the repository that have been updated
# to check for consistency in the .NET 9 upgrade

# Find all Dockerfiles
fd Dockerfile

# Then check their content for .NET 9 references
fd Dockerfile --exec cat {}

Length of output: 8344


Script:

#!/bin/bash
# Let's also check the project files to verify .NET 9 target framework
fd .csproj --exec grep -l "net9.0" {}

Length of output: 39


Script:

#!/bin/bash
# Check global.json if it exists to verify SDK version
find . -name global.json -exec cat {} \;

Length of output: 119

tests/Digdir.Domain.Dialogporten.GraphQl.Integration.Tests/Digdir.Domain.Dialogporten.GraphQl.Integration.Tests.csproj (2)

13-13: LGTM! Package upgrade aligns with .NET 9 migration

The upgrade of Microsoft.AspNetCore.Mvc.Testing to version 9.0.0 is consistent with the PR objective of upgrading to .NET 9.


16-16: Verify test stability after Verify.Xunit upgrade

The patch upgrade of Verify.Xunit from 28.2.0 to 28.2.1 looks good, but let's verify there are no breaking changes in the snapshot tests.

src/Digdir.Domain.Dialogporten.Infrastructure/MigrationBundle.dockerfile (3)

1-3: LGTM! Secure base image configuration.

The base image is properly configured with:

  • Explicit version tag (9.0.0)
  • SHA256 digest for image verification
  • Appropriate minimal runtime image (aspnet)

4-5: LGTM! Secure build image configuration.

The build image is properly configured with:

  • Explicit version tag (9.0.100)
  • SHA256 digest for image verification
  • Appropriate SDK image for building

Line range hint 1-31: Verify .NET 9.0 compatibility across the solution.

Since this is part of upgrading to .NET 9.0, we should verify that all related projects and dependencies are compatible with .NET 9.0.

✅ Verification successful

Let me generate another script to check the target frameworks since the previous output didn't show them.


All projects are correctly configured for .NET 9.0 with compatible package versions

The verification shows:

  • All projects inherit net9.0 target framework from Directory.Build.props
  • Key Microsoft packages are on version 9.0.0 (AspNetCore, Extensions, etc.)
  • Database-related packages (Npgsql, EF Core) are on compatible versions (8.0.x)
  • Testing packages (xUnit, FluentAssertions) and other third-party libraries are on their latest stable versions
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for potential compatibility issues with .NET 9

# Check if all projects are targeting net9.0
echo "Checking project target frameworks..."
find . -name "*.csproj" -exec grep -l "TargetFramework" {} \; | while read -r file; do
    echo "Checking $file:"
    grep -A 1 "<TargetFramework" "$file"
done

# Check for package references that might need updates
echo -e "\nChecking package versions..."
find . -name "*.csproj" -exec grep -A 1 "PackageReference" {} \;

Length of output: 15103


Script:

#!/bin/bash
# Search for TargetFramework elements in all csproj files
find . -name "*.csproj" -exec sh -c 'echo "=== $1 ==="; cat "$1" | grep -A1 "<TargetFramework"' sh {} \;

# Also check Directory.Build.props for any framework settings
if [ -f "Directory.Build.props" ]; then
    echo -e "\n=== Directory.Build.props Framework Settings ==="
    cat Directory.Build.props | grep -A1 "<TargetFramework"
fi

Length of output: 2856

src/Digdir.Tool.Dialogporten.SlackNotifier/Digdir.Tool.Dialogporten.SlackNotifier.csproj (5)

13-13: LGTM! Correct SDK version alignment

The Azure Functions Worker SDK version 2.0.0 correctly aligns with the Worker runtime version 2.0.0.


15-15: LGTM! Correct version for .NET 9

The UserSecrets package version 9.0.0 correctly aligns with the target .NET 9 framework.


14-14: Verify compatibility of unchanged package versions

Some packages remain on older versions:

  • Microsoft.Extensions.Azure (1.8.0)
  • Microsoft.Azure.Functions.Worker.Extensions.Http (3.2.0)

Please verify their compatibility with .NET 9 and consider upgrading if newer versions are available.

#!/bin/bash
# Check for other project files using these packages to ensure consistent versions
rg --type xml "Microsoft.Extensions.Azure|Microsoft.Azure.Functions.Worker.Extensions.Http"

11-11: Review Azure Functions Worker 2.0 migration guide

The upgrade from Worker 1.x to 2.0 is a major version change that may include breaking changes. Please ensure you've reviewed the migration guide and tested the following areas:

  • Middleware changes
  • Worker configuration updates
  • Custom binding implementations

Consider the following verification steps:

✅ Verification successful

Based on the search results, I can see that the Azure Functions Worker configuration is minimal and straightforward. The Program.cs only uses .ConfigureFunctionsWorkerDefaults() without any custom middleware or worker configuration. There are no custom bindings or middleware implementations found in the codebase.

Azure Functions Worker 2.0 upgrade appears safe

The upgrade from 1.x to 2.0 should not cause any issues since:

  • No custom middleware implementations are used
  • No custom binding implementations are present
  • No worker-specific configuration is being customized
  • Only using the default worker configuration
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for potential breaking changes in middleware usage
rg -A 5 "IFunctionsWorkerMiddleware|AddMiddleware"

# Check for custom bindings
rg -A 5 "FunctionBindingAttribute"

Length of output: 242


Script:

#!/bin/bash
# Search for middleware and configuration patterns in C# files
rg -t cs "IFunctionsWorkerMiddleware|AddMiddleware|ConfigureFunctionsWorkerDefaults|ConfigureFunctionsWorker"

# Search for custom binding patterns in C# files
rg -t cs "FunctionBindingAttribute|BindingAttribute|CustomBinding"

# Check Program.cs or Startup.cs for worker configuration
fd -e cs "(Program|Startup).cs" --exec cat {}

Length of output: 37515


10-10: Verify if explicit System.Text.Json reference is necessary

Since System.Text.Json is part of the .NET framework, this explicit package reference might not be needed unless you require a specific version different from what's included in .NET 9.

src/Digdir.Domain.Dialogporten.Janitor/Digdir.Domain.Dialogporten.Janitor.csproj (3)

10-15: LGTM: Microsoft.Extensions package versions are consistently updated.

The Microsoft.Extensions packages have been consistently updated to version 9.0.0, which is correct for the .NET 9 upgrade.


Line range hint 1-38: Verify TargetFramework configuration

The project file doesn't specify an explicit TargetFramework. According to the PR summary, this is now handled in Directory.Build.props.

✅ Verification successful

Framework targeting configuration is correctly handled in Directory.Build.props

The verification confirms that:

  • The TargetFramework (net9.0) is properly defined in Directory.Build.props
  • No other .csproj files contain explicit TargetFramework definitions, indicating proper inheritance from Directory.Build.props
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify framework targeting configuration

# Check Directory.Build.props for framework targeting
echo "Checking Directory.Build.props..."
fd -t f "Directory.Build.props" -x cat {}

# Check if any other projects still have explicit TargetFramework
echo -e "\nChecking for explicit TargetFramework in other project files..."
rg -l "TargetFramework" -g "*.csproj"

Length of output: 980


Script:

#!/bin/bash
# Description: Verify framework targeting configuration with proper quoting

# Check Directory.Build.props for framework targeting
echo "Checking Directory.Build.props..."
fd -t f "Directory.Build.props" -x cat {}

# Check if any other projects still have explicit TargetFramework
echo -e "\nChecking for explicit TargetFramework in other project files..."
rg -l "TargetFramework" -g "*.csproj" || true

Length of output: 892


9-9: Verify third-party package compatibility with .NET 9

Please verify the compatibility of the following packages with .NET 9:

  • Cocona 2.2.0
  • Serilog packages (various versions)

Consider:

  1. Upgrading these packages to their latest versions that support .NET 9
  2. Adding a comment in the csproj file documenting any packages intentionally kept at older versions

Also applies to: 16-20

✅ Verification successful

All packages are compatible with .NET 9

Based on the verification results:

  • The project uses .NET 9 SDK (version 9.0.100)
  • Cocona 2.2.0 is used alongside other .NET 9 compatible packages like Microsoft.Extensions.Hosting 9.0.0
  • All Serilog packages are at their latest versions and are compatible with .NET 9:
    • Serilog.Extensions.Hosting 8.0.0
    • Serilog.Settings.Configuration 8.0.4
    • Serilog.Sinks.ApplicationInsights 4.0.0
    • Serilog.Sinks.Console 6.0.0
    • Serilog.Enrichers.Environment 3.0.1
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check NuGet packages for .NET 9 compatibility and latest versions

# Check package details from NuGet
for package in "Cocona" "Serilog.Extensions.Hosting" "Serilog.Settings.Configuration" "Serilog.Sinks.ApplicationInsights" "Serilog.Sinks.Console" "Serilog.Enrichers.Environment"; do
    echo "Checking $package..."
    curl -s "https://api.nuget.org/v3/registration5-semver1/$package/index.json" | jq -r '.items[0].items[0].catalogEntry | {version, dependencyGroups}'
done

Length of output: 980


Script:

#!/bin/bash
# Let's try a different approach to check package versions and dependencies

# First, let's check if there are any package references in the csproj files
echo "Checking package references in csproj files:"
fd -e csproj -x cat {} \; | grep -A1 -B1 "PackageReference"

# Then, let's check the global.json for SDK version
echo -e "\nChecking global.json for SDK version:"
fd global.json -x cat {}

# Finally, let's check all csproj files for target framework
echo -e "\nChecking target frameworks in all csproj files:"
fd -e csproj -x cat {} \; | grep -A1 -B1 "TargetFramework"

Length of output: 16638

src/Digdir.Domain.Dialogporten.Service/Dockerfile (2)

4-4: LGTM! Dockerfile structure follows best practices

The SDK version matches the runtime version, and the Dockerfile follows good practices including:

  • Multi-stage builds for smaller final image
  • Proper layer caching
  • Security considerations with non-root user

Let's verify SDK compatibility with all project files:

#!/bin/bash
# Check if any project files specify incompatible target frameworks
echo "Checking .NET SDK compatibility..."
find . -name "*.csproj" -exec grep -l "TargetFramework" {} \; | while read -r file; do
    echo "Checking $file..."
    grep -A 1 "<TargetFramework" "$file"
done

1-1: Verify .NET 9.0 production readiness

While using SHA256 hashes is good for reproducible builds, please note that .NET 9.0 is currently in preview/RC stage and not recommended for production use yet. Consider the following:

  1. Ensure your team is aware of the preview status and its implications
  2. For production builds, consider using the more flexible tag format 9.0-alpine to receive security updates while maintaining major version compatibility
src/Digdir.Domain.Dialogporten.WebApi/Dockerfile (2)

1-1: Verify if newer patch version is available for the base image

The base image upgrade to .NET 9.0 looks good and using SHA256 digest is a security best practice. However, let's verify if there's a newer patch version available.

#!/bin/bash
# Description: Check for latest .NET 9.0 ASP.NET Runtime images
# Expected: List of available tags to ensure we're using the latest patch version

curl -s "https://mcr.microsoft.com/v2/dotnet/aspnet/tags/list" | jq '.tags[] | select(contains("9.0"))'

5-5: Verify if newer SDK version is available

The SDK image upgrade to .NET 9.0 looks good and using SHA256 digest is a security best practice. However, let's verify if there's a newer SDK version available.

✅ Verification successful

Using the latest stable SDK version

The current SDK version 9.0.100 is the latest stable version available. All other versions shown in the output are either preview releases (preview.1 through preview.7) or release candidates (rc.1, rc.2). Using the stable version with SHA256 digest is the recommended approach.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for latest .NET 9.0 SDK images
# Expected: List of available tags to ensure we're using the latest SDK version

curl -s "https://mcr.microsoft.com/v2/dotnet/sdk/tags/list" | jq '.tags[] | select(contains("9.0"))'

Length of output: 8972

src/Digdir.Domain.Dialogporten.GraphQL/Dockerfile (2)

5-7: Verify SDK version compatibility with dependencies

The SDK version 9.0.100 should be compatible with all project dependencies. Please ensure all NuGet packages support .NET 9.

✅ Verification successful

The previous output shows that most packages are already compatible with .NET 9.0.0, including core Microsoft packages. However, we need to verify the target framework version of the projects to ensure they're configured for .NET 9. Let's get that information before making a final determination.


Let's try a different approach to find the target framework information. The previous command might have failed due to formatting differences in the project files.


SDK version 9.0.100 appears compatible with project dependencies

Based on the package references found in the codebase:

  • Core Microsoft packages are already on version 9.0.0 (e.g., Microsoft.Extensions.Hosting, Microsoft.AspNetCore.Authentication.JwtBearer)
  • Entity Framework Core packages are on 8.0.10 but have a known upgrade path to .NET 9
  • Third-party packages are on recent versions with no known incompatibilities with .NET 9

While we couldn't verify the target framework directly, the extensive use of .NET 9.0.0 packages across the solution strongly suggests compatibility with SDK 9.0.100.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check project files for package references and their versions
fd -e csproj | xargs cat | grep -A 1 "PackageReference"

# Look for target framework in project files
fd -e csproj | xargs grep -l "TargetFramework"

Length of output: 15057


Script:

#!/bin/bash
# Check target framework versions in project files
fd -e csproj | xargs grep -A 1 "TargetFramework"

Length of output: 48


Script:

#!/bin/bash
# Try a different approach to find target framework
fd -e csproj | xargs cat | grep -i "targetframework"

Length of output: 52


1-4: Verify .NET 9.0.0 release stability

While using SHA256 digests is a good security practice, .NET 9.0.0 is a very recent release. Please ensure it's a stable release suitable for production use.

src/Digdir.Domain.Dialogporten.GraphQL/Digdir.Domain.Dialogporten.GraphQL.csproj (3)

14-14: Verify the need for System.Drawing.Common

System.Drawing.Common has known platform compatibility limitations, especially on non-Windows systems. Consider using cross-platform alternatives like ImageSharp or SkiaSharp if image processing is required.

#!/bin/bash
# Check for any existing image processing code that might explain this dependency
rg -g "*.cs" "System\.Drawing" -A 5

4-18: Verify compatibility of non-upgraded packages with .NET 9

Several packages haven't been updated as part of the .NET 9 upgrade:

  • Microsoft.Azure.AppConfiguration.AspNetCore is still on 8.0.0
  • Azure.Identity is on 1.13.1
  • Various Serilog packages are on different versions

Please verify that these versions are compatible with .NET 9.

#!/bin/bash
# Check if these package versions are used consistently across the solution
rg -g "*.csproj" "Microsoft\.Azure\.AppConfiguration\.AspNetCore|Azure\.Identity|Serilog" -A 1 -B 1

6-6: 🛠️ Refactor suggestion

Consider aligning JWT package versions with .NET 9

While Microsoft.AspNetCore.Authentication.JwtBearer is correctly updated to 9.0.0, the IdentityModel packages are still on 8.x versions. Microsoft typically recommends keeping these versions in sync with the runtime to avoid potential compatibility issues.

Consider updating these packages to their 9.0.0 versions if available:

-        <PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.2.0" />
-        <PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.2.0" />
+        <PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="9.0.0" />
+        <PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="9.0.0" />

Also applies to: 13-13, 15-15

src/Digdir.Domain.Dialogporten.Application/Digdir.Domain.Dialogporten.Application.csproj (2)

11-11: LGTM: Minor patch update for HtmlAgilityPack

The update from 1.11.70 to 1.11.71 follows semantic versioning and should be safe.


12-13: Verify package compatibility with .NET 9

While the Microsoft.Extensions.* packages have been updated to 9.0.0, some other packages are still on .NET 8 versions. Please verify compatibility, particularly for:

  • Npgsql (8.0.5)
  • Npgsql.EntityFrameworkCore.PostgreSQL (8.0.10)

Also applies to: 14-20

✅ Verification successful

Let me try a different approach to verify the package compatibility by checking the target framework in the project file and related package information.


Let me check the target framework of the project to make a more informed decision.


Npgsql packages are compatible with .NET 9

The project is correctly configured for .NET 9.0 and the current Npgsql packages (8.0.5) and Npgsql.EntityFrameworkCore.PostgreSQL (8.0.10) are fully compatible with .NET 9.0. These packages follow semantic versioning where the major version (8.x) indicates the minimum supported EF Core version, not the .NET version. They are designed to be forward compatible with newer .NET versions.

This is evidenced by:

  • The project's target framework is explicitly set to net9.0 in Directory.Build.props
  • The project is using .NET 9 SDK version 9.0.100
  • Other .NET 9 dependencies are already working with these Npgsql packages in the solution
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check NuGet packages for .NET 9 compatibility and latest versions

# Function to query NuGet API for package versions
check_package() {
  local package=$1
  echo "Checking $package..."
  curl -s "https://api.nuget.org/v3-flatcontainer/$package/index.json" | jq -r '.versions[]' | grep -E "^9\." || echo "No .NET 9 versions found"
}

# Check specific packages
packages=(
  "Npgsql"
  "Npgsql.EntityFrameworkCore.PostgreSQL"
)

for package in "${packages[@]}"; do
  check_package "$package"
done

Length of output: 914


Script:

#!/bin/bash
# Check target framework and package references
cat src/Digdir.Domain.Dialogporten.Application/Digdir.Domain.Dialogporten.Application.csproj

# Check if there are any other project files that might show package patterns
fd -e csproj -x cat {}

Length of output: 29502


Script:

#!/bin/bash
# Check target framework in Directory.Build.props or any global properties
fd -e props -x cat {}

# Check global.json for SDK version
cat global.json 2>/dev/null || echo "global.json not found"

Length of output: 701

src/Digdir.Domain.Dialogporten.WebApi/Digdir.Domain.Dialogporten.WebApi.csproj (3)

15-16: Verify JWT package versions for security and compatibility

The added JWT packages are using version 8.2.0. While these packages follow a different versioning scheme than .NET core packages, we should verify:

  1. If these are the latest stable versions
  2. If there are any known security vulnerabilities

Let's check for the latest versions and security advisories:

#!/bin/bash
# Description: Check JWT package versions and security advisories

# Check for any security advisories for these packages
gh api graphql -f query='
{
  securityVulnerabilities(first: 5, ecosystem: NUGET, package: "System.IdentityModel.Tokens.Jwt") {
    nodes {
      advisory {
        summary
        severity
        publishedAt
      }
      vulnerableVersionRange
      firstPatchedVersion {
        identifier
      }
    }
  }
}'

# Look for any JWT-related configuration that might need updates
echo -e "\nChecking JWT configuration files:"
rg -l "JWT" --type json --type xml

Line range hint 17-21: Review mixed package versions for .NET 9 compatibility

Some packages are still at version 8.x.x (e.g., Microsoft.Azure.AppConfiguration.AspNetCore 8.0.0). While this might be intentional due to different versioning schemes, we should verify compatibility with .NET 9.

Let's check the compatibility matrix:

✅ Verification successful

Let me try a different approach to verify the package compatibility.


Based on the shell script results, I can now provide a final response:

Package versions are compatible with .NET 9

The project is correctly configured for .NET 9 (as seen in Directory.Build.props and global.json), and the package versions are appropriate:

  • Microsoft.Azure.AppConfiguration.AspNetCore 8.0.0 is compatible with .NET 9 as it follows Microsoft's versioning scheme where major version indicates the minimum supported .NET version
  • Serilog packages (AspNetCore 8.0.3, Enrichers.Environment 3.0.1, Sinks.ApplicationInsights 4.0.0) are all compatible with .NET 9 as they follow semantic versioning independent of .NET version
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check package compatibility with .NET 9

# Look for package compatibility documentation
echo "Checking Azure.AppConfiguration compatibility:"
curl -s "https://www.nuget.org/packages/Microsoft.Azure.AppConfiguration.AspNetCore" | grep -A 5 "Dependencies"

# Check if newer versions are available
echo -e "\nChecking for newer versions:"
for pkg in "Microsoft.Azure.AppConfiguration.AspNetCore" "Serilog.AspNetCore" "Serilog.Enrichers.Environment" "Serilog.Sinks.ApplicationInsights"
do
    curl -s "https://api.nuget.org/v3-flatcontainer/$pkg/index.json" | jq -r '.versions[]' | tail -n 5
done

Length of output: 2343


Script:

#!/bin/bash
# Search for global.json or Directory.Build.props to determine target framework version
echo "Checking target framework version:"
fd -e json global.json -x cat {}
fd -e props "Directory.Build.props" -x cat {}

# Check all project files for target framework and package references
echo -e "\nChecking all project files:"
fd -e csproj . -x cat {}

Length of output: 28499


12-14: Verify stability and compatibility of core ASP.NET packages

The upgrade to version 9.0.0 for core ASP.NET packages aligns with the .NET 9 migration. However, being initial release versions, they might have stability concerns.

Let's verify the compatibility of other dependencies:

tests/Digdir.Domain.Dialogporten.Application.Integration.Tests/Digdir.Domain.Dialogporten.Application.Integration.Tests.csproj (2)

12-12: Verify necessity of System.Drawing.Common

The inclusion of System.Drawing.Common in a test project is unusual. Let's verify if this package is actually used in the tests.

#!/bin/bash
# Description: Check usage of System.Drawing namespace in test files

echo "Searching for System.Drawing usage in test files:"
rg -l "using.*System\.Drawing" -g "*.cs"

# Check if there are any image-related test utilities or helpers
echo -e "\nSearching for potential image-related test code:"
rg -l "\.png|\.jpg|\.jpeg|\.bmp|\.gif|Bitmap|Graphics|Image" -g "*.cs"

10-11: Verify JWT package versions for .NET 9 compatibility

The JWT-related packages (Microsoft.IdentityModel.JsonWebTokens and System.IdentityModel.Tokens.Jwt) are at version 8.2.0. Let's verify if these are the latest stable versions compatible with .NET 9.

✅ Verification successful

JWT package versions are consistent and properly used

The version 8.2.0 of JWT packages is consistently used across the solution in multiple projects:

  • WebApi
  • GraphQL
  • Infrastructure
  • Integration Tests

The packages are actively used in authentication and authorization code, particularly in:

  • JWT scheme selection middleware
  • Token validation and handling
  • Dialog token middleware

Since these packages are part of a coordinated upgrade across the solution and are actively used in the codebase, the version 8.2.0 appears to be a deliberate choice for .NET 9 compatibility.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check latest versions of JWT packages and their compatibility with .NET 9

# Check if there are any newer versions of these packages
dotnet-search() {
    local package=$1
    curl -s "https://api.nuget.org/v3/registration5-semver1/$package/index.json" | jq -r '.items[0].upper'
}

echo "Latest versions:"
echo "Microsoft.IdentityModel.JsonWebTokens: $(dotnet-search microsoft.identitymodel.jsonwebtokens)"
echo "System.IdentityModel.Tokens.Jwt: $(dotnet-search system.identitymodel.tokens.jwt)"

# Search for any usage of these packages in test files
echo -e "\nUsage in tests:"
rg -l "using.*IdentityModel" -g "*.cs"

Length of output: 591


Script:

#!/bin/bash
# Let's try a different approach to check JWT package usage and versions

# First, let's find all .csproj files to check package versions across the solution
echo "Checking JWT package versions across solution:"
rg --type xml "Microsoft\.IdentityModel\.JsonWebTokens|System\.IdentityModel\.Tokens\.Jwt" -g "*.csproj" -A 1

# Then, let's look for JWT-related code usage
echo -e "\nSearching for JWT usage in code:"
rg "using\s+(Microsoft\.IdentityModel|System\.IdentityModel)" -g "*.cs"

# Let's also check for JWT-related classes and methods
echo -e "\nSearching for JWT-related code patterns:"
rg "JwtSecurityToken|JwtRegisteredClaimNames|JsonWebToken" -g "*.cs"

Length of output: 5245

tests/Digdir.Domain.Dialogporten.Architecture.Tests/Digdir.Domain.Dialogporten.Architecture.Tests.csproj (1)

12-12: Verify package version compatibility with .NET 9

The Microsoft.Build package has been updated to 17.12.6. Let's verify the compatibility of all package versions with .NET 9 and ensure version consistency across the solution.

✅ Verification successful

Package versions are consistent and compatible with .NET 9

The verification shows:

  • Microsoft.Build 17.12.6 is used consistently and is the only instance in the solution
  • Test packages across all test projects are at compatible versions:
    • Microsoft.NET.Test.Sdk 17.11.1
    • xUnit 2.9.2
    • FluentAssertions 6.12.2

These versions are all recent and compatible with .NET 9, as confirmed by the target framework setting in Directory.Build.props.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check package versions across all test projects and verify .NET 9 compatibility

# Find all test project files
echo "Checking package versions across test projects..."
fd -e csproj$ -E "*bin*" -E "*obj*" | while read -r proj; do
  echo "=== $proj ==="
  # Extract package references with versions
  cat "$proj" | grep -A 1 "PackageReference Include="
done

# Check if Directory.Build.props exists and contains target framework
echo -e "\nChecking target framework in Directory.Build.props..."
if [ -f "Directory.Build.props" ]; then
  cat "Directory.Build.props" | grep -A 2 "<TargetFramework"
fi

Length of output: 514


Script:

#!/bin/bash
# Let's check all package references in the specific test project and other related projects
echo "=== Checking package versions in the architecture test project ==="
cat "tests/Digdir.Domain.Dialogporten.Architecture.Tests/Digdir.Domain.Dialogporten.Architecture.Tests.csproj"

echo -e "\n=== Checking Microsoft.Build package references across solution ==="
rg -l "Microsoft.Build" --type csproj

echo -e "\n=== Checking versions of Microsoft.Build where used ==="
rg "Microsoft.Build" --type csproj -A 1

Length of output: 2847


Script:

#!/bin/bash
# Let's try without file type filtering since csproj is not recognized
echo "=== Checking Microsoft.Build package references across solution ==="
rg -l "Microsoft.Build"

echo -e "\n=== Checking versions of Microsoft.Build where used ==="
rg "<PackageReference Include=\"Microsoft.Build\"" -A 1

echo -e "\n=== Checking test package versions for .NET 9 compatibility ==="
rg "<PackageReference Include=\"Microsoft.NET.Test.Sdk\"" -A 1
rg "<PackageReference Include=\"xunit\"" -A 1
rg "<PackageReference Include=\"FluentAssertions\"" -A 1

Length of output: 8208

src/Digdir.Domain.Dialogporten.Infrastructure/Digdir.Domain.Dialogporten.Infrastructure.csproj (2)

17-22: Verify EntityFrameworkCore package versions for .NET 9 compatibility

All EntityFrameworkCore related packages are at version 8.0.10. Please verify if these versions are compatible with .NET 9 and if newer versions are available.

#!/bin/bash
# Check latest versions of EF Core packages
echo "Checking Npgsql.EntityFrameworkCore.PostgreSQL versions:"
curl -s https://api.nuget.org/v3-flatcontainer/npgsql.entityframeworkcore.postgresql/index.json | jq '.versions[]' | tail -n 5

echo "Checking Microsoft.EntityFrameworkCore.Tools versions:"
curl -s https://api.nuget.org/v3-flatcontainer/microsoft.entityframeworkcore.tools/index.json | jq '.versions[]' | tail -n 5

9-9: Verify compatibility of Identity packages with .NET 9

The Identity packages are at version 8.2.0:

  • Microsoft.IdentityModel.JsonWebTokens
  • System.IdentityModel.Tokens.Jwt

Let's verify if this is the latest stable version compatible with .NET 9.

Also applies to: 11-11

✅ Verification successful

The script output shows results for different packages (Npgsql and EF Core) than what we requested. Let me try again with the correct URLs.


Let me try one more time with a simpler approach using the v3-flatcontainer endpoint:


Identity packages are at the latest stable version

The current version 8.2.0 is the latest stable release for both packages:

  • Microsoft.IdentityModel.JsonWebTokens
  • System.IdentityModel.Tokens.Jwt

These packages are compatible with .NET 9 as they follow semantic versioning and are framework-agnostic. The major version 8.x.x is the current stable branch that supports both .NET 7/8/9.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check latest versions of Identity packages
echo "Checking Microsoft.IdentityModel.JsonWebTokens versions:"
curl -s https://api.nuget.org/v3-flatcontainer/microsoft.identitymodel.jsonwebtokens/index.json | jq '.versions[]' | tail -n 5

echo "Checking System.IdentityModel.Tokens.Jwt versions:"
curl -s https://api.nuget.org/v3-flatcontainer/system.identitymodel.tokens.jwt/index.json | jq '.versions[]' | tail -n 5

Length of output: 679


Script:

#!/bin/bash
# Check latest versions of Identity packages
echo "Checking Microsoft.IdentityModel.JsonWebTokens versions:"
curl -s "https://api.nuget.org/v3/registration5-gz-semver2/microsoft.identitymodel.jsonwebtokens/index.json" | jq -r '.items[0].items[].catalogEntry.version' | sort -V | tail -n 5

echo -e "\nChecking System.IdentityModel.Tokens.Jwt versions:"
curl -s "https://api.nuget.org/v3/registration5-gz-semver2/system.identitymodel.tokens.jwt/index.json" | jq -r '.items[0].items[].catalogEntry.version' | sort -V | tail -n 5

# Also check target framework in the project file
echo -e "\nChecking target framework:"
cat src/Digdir.Domain.Dialogporten.Infrastructure/Digdir.Domain.Dialogporten.Infrastructure.csproj | grep -A 1 "<PropertyGroup>"

Length of output: 909


Script:

#!/bin/bash
# Check latest versions of Identity packages
echo "Checking Microsoft.IdentityModel.JsonWebTokens versions:"
curl -s "https://api.nuget.org/v3-flatcontainer/microsoft.identitymodel.jsonwebtokens/index.json" | jq -r '.versions[]' | sort -V | tail -n 5

echo -e "\nChecking System.IdentityModel.Tokens.Jwt versions:"
curl -s "https://api.nuget.org/v3-flatcontainer/system.identitymodel.tokens.jwt/index.json" | jq -r '.versions[]' | sort -V | tail -n 5

# Check target framework
echo -e "\nChecking target framework:"
cat src/Digdir.Domain.Dialogporten.Infrastructure/Digdir.Domain.Dialogporten.Infrastructure.csproj | grep -E "TargetFramework|net[0-9]"

Length of output: 784

src/Digdir.Domain.Dialogporten.GraphQL/OpenTelemetryEventListener.cs (2)

75-76: LGTM: Consistent use of updated OpenTelemetry API

The change maintains consistency with the updated API usage pattern.


47-48: LGTM: Updated to use newer OpenTelemetry API

The change from RecordException to AddException aligns with the newer OpenTelemetry API conventions in .NET 9.

Let's verify this API change across the codebase:

✅ Verification successful

API change to AddException is consistently applied and correct

The change from RecordException to AddException is correctly implemented across all exception handling locations in the file (lines 47, 75, and 88). This change aligns with OpenTelemetry's newer API in .NET 9, and the implementation is consistent throughout the OpenTelemetryEventListener class. All exception recording scenarios use the new AddException method along with appropriate status setting via SetStatus.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining usage of RecordException that might need updating
# Expect: No occurrences of RecordException in activity recording

rg "RecordException" --type cs

Length of output: 30


Script:

#!/bin/bash
# Let's verify the Activity class usage and exception handling patterns
# This will help us understand the API changes better

# First, let's find all files that use Activity-related code
rg "Activity\." --type cs -B 2 -A 2

# Also check for any OpenTelemetry related using statements
rg "using.*OpenTelemetry" --type cs

Length of output: 10310


Script:

#!/bin/bash
# Let's check the specific file for all Activity-related method calls to understand the full context
# and verify if the change is consistent within the file

cat src/Digdir.Domain.Dialogporten.GraphQL/OpenTelemetryEventListener.cs

Length of output: 3879

@oskogstad oskogstad merged commit 7883519 into main Nov 14, 2024
22 checks passed
@oskogstad oskogstad deleted the chore/update-to-dotnet-9 branch November 14, 2024 12:04
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.

3 participants