Skip to content

Fix/687 - NativeAoT Support by upgrading to Dotnet 8 (lts) and implementing System.Text.Json source generation#745

Open
ThaDaVos wants to merge 12 commits intopulumi:mainfrom
ThaDaVos:fix/687-json-source-generator
Open

Fix/687 - NativeAoT Support by upgrading to Dotnet 8 (lts) and implementing System.Text.Json source generation#745
ThaDaVos wants to merge 12 commits intopulumi:mainfrom
ThaDaVos:fix/687-json-source-generator

Conversation

@ThaDaVos
Copy link

@ThaDaVos ThaDaVos commented Nov 9, 2025

These changes should allow one to use the project with NativeAoT as it now uses the latest LTS (Dotnet 8) and includes source generation for System.Text.Json.

Only thing I noticed after getting all System.Text.Json stuff working while setting <JsonSerializerIsReflectionEnabledByDefault>false</JsonSerializerIsReflectionEnabledByDefault> in my project - is that I get an error from the grpc package used:

Exception has occurred: CLR/Grpc.Core.RpcException
An exception of type 'Grpc.Core.RpcException' occurred in Pulumi.dll but was not handled in user code: 'Status(StatusCode="Unimplemented", Detail="")'
   at Pulumirpc.LanguageRuntime.LanguageRuntimeBase.GetRequiredPackages(GetRequiredPackagesRequest request, ServerCallContext context) in {PROJECT_PATH}\pulumi-dotnet\sdk\Pulumi\obj\Debug\net8.0\pulumi\LanguageGrpc.cs:line 311
   at Grpc.Shared.Server.UnaryServerMethodInvoker`3.Invoke(HttpContext httpContext, ServerCallContext serverCallContext, TRequest request)

Which I cannot figure out the actual cause of

Copilot AI review requested due to automatic review settings November 9, 2025 13:55
@ThaDaVos ThaDaVos requested a review from a team as a code owner November 9, 2025 13:55
Copy link

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

This PR upgrades the Pulumi .NET SDK from .NET 6.0 to .NET 8.0 and updates numerous dependencies to their latest versions. The changes modernize the codebase with C# 12 features including collection expressions, primary constructors, and improved null checks.

Key changes:

  • Upgrade target framework from net6.0 to net8.0 across all projects
  • Update semver package from v2.1.0 to v3.0.0 (requires API changes due to removed IComparable interface)
  • Update multiple Grpc, Microsoft, and other NuGet packages to latest versions
  • Modernize C# code with collection expressions ([] syntax), ArgumentNullException.ThrowIfNull(), and other C# 12 features
  • Add source generation context for JSON serialization performance improvements

Reviewed Changes

Copilot reviewed 35 out of 37 changed files in this pull request and generated no comments.

Show a summary per file
File Description
sdk/Pulumi/Pulumi.csproj Updates target framework to net8.0 and dependencies to latest versions
sdk/Pulumi/Serialization/ResourcePackages.cs Adapts SemVer usage to v3.0 API (CompareSortOrderTo instead of comparison operators)
sdk/Pulumi/Stack.cs Replaces .Any() with .Count != 0 for performance
sdk/Pulumi/Core/Output.cs Modernizes null checks and adds cached JsonSerializerOptions
sdk/Pulumi/Deployment/*.cs Modernizes argument validation and string operations
sdk/Pulumi.Automation/*.cs Updates to collection expressions and SemVer v3.0 API
sdk/Pulumi.Automation/Serialization/*.cs Adds source generation for JSON serialization
Test projects Updates test dependencies to latest versions
PublicAPI files Adds nullable reference type annotations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ThaDaVos ThaDaVos changed the title Fix/687 - NativeAoT Support by ppgrading to Dotnet 8 (lts) and implementing System.Text.Json source generation Fix/687 - NativeAoT Support by upgrading to Dotnet 8 (lts) and implementing System.Text.Json source generation Nov 9, 2025
@Frassle
Copy link
Member

Frassle commented Nov 18, 2025

Upgrade target framework from net6.0 to net8.0 across all projects

We'll have to think about this. We don't officially support net6 anymore (neither does Microsoft) but it is still a breaking change. I'll see if we can collect some data to see if we're likely to break anyone doing this.

@ThaDaVos
Copy link
Author

@Frassle - why not release it as a new major version? Also, as far as I know, if the Dotnet version is bumped, older dotnet based projects shouldn't pull it anyway (as far as I know).

That aside, how can I fix the protobuf "not implemented" issue? That way I could build it locally and use it for myself at least.

@ThaDaVos
Copy link
Author

Just got my GRPC issue fixed, I missed the -p:PulumiSdkVersion=3.205.0 - this is needed it seems.
Also noticed I missed a JsonSerializer.Serialize call and added this one too

@Frassle Frassle self-assigned this Jan 24, 2026
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.

2 participants

Comments