Skip to content

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

Closed
ThaDaVos wants to merge 12 commits into
pulumi:mainfrom
ThaDaVos:fix/687-json-source-generator
Closed

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

Conversation

@ThaDaVos

@ThaDaVos ThaDaVos commented Nov 9, 2025

Copy link
Copy Markdown

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

Copilot AI left a comment

Copy link
Copy Markdown

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

Frassle commented Nov 18, 2025

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
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
@ThaDaVos

ThaDaVos commented Aug 7, 2026

Copy link
Copy Markdown
Author

It's been months since I made this PR and I haven't heard anything since, has there been any progress?

@Frassle

Frassle commented Aug 7, 2026

Copy link
Copy Markdown
Member

We still think bumping to net8 is going to cause significant downstream breakage because of how net builds work, so we're still stuck to targeting net6 for now.

We started making a plan to fix this but it hasn't been an internal priority to actually get it finished, and is made more complicated by the fact that we need to coordinate the fix across multiple internal teams and external provider developers.

@ThaDaVos

ThaDaVos commented Aug 7, 2026

Copy link
Copy Markdown
Author

Can't you do a bump to DotNet 8 in a major version of the (Automation) SDK? This would partially resolve the issue as most of the time major versions are allowed to break backwards compatibility and instead of targeting DotNet 8, go straight for DotNet 10 LTS to also get some other improvements - also DotNet 8 will be end of support in November this year (https://dotnet.microsoft.com/en-us/platform/support/policy/dotnet-core)

@Frassle

Frassle commented Aug 7, 2026

Copy link
Copy Markdown
Member

Can't you do a bump to DotNet 8 in a major version of the (Automation) SDK?

We have historically avoided major version changes because of a want to keep the engine version and sdk versions tied. That might be less important now so we could consider it.

go straight for DotNet 10 LTS to also get some other improvements - also DotNet 8 will be end of support in November this year

Yes, we're aware of the dotnet 8 LTS coming to an end soon. A major bump direct to 10 as we drop 8 LTS is definitely worth considering.

@ThaDaVos

ThaDaVos commented Aug 7, 2026

Copy link
Copy Markdown
Author

If there is help wanted with a PR for DotNet 10 (Including a redo of the source generation here for NativeAoT) let me know, I may be able to lend a hand if I have the time

@ThaDaVos

Copy link
Copy Markdown
Author

@Frassle can you check the new PR?
#1109

@ThaDaVos ThaDaVos closed this Aug 10, 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.

3 participants