Fix/687 - NativeAoT Support by upgrading to Dotnet 8 (lts) and implementing System.Text.Json source generation#745
Conversation
…nalyzers --diagnostics=RS0016` to regenerate the `PublicAPI.*.txt` files
…g due to line-ending mismatch
…ition of a converter - which fails if a cached instance is used
…d to mix `Query` and `Method-based` to get it working again
There was a problem hiding this comment.
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.0tonet8.0across all projects - Update semver package from v2.1.0 to v3.0.0 (requires API changes due to removed
IComparableinterface) - 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.
System.Text.Json source generationSystem.Text.Json source generation
…PublicAPI.Shipped.txt` ascending, lastly passing through CancellationToken as needed
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. |
|
@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. |
|
Just got my GRPC issue fixed, I missed the |
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.Jsonstuff working while setting<JsonSerializerIsReflectionEnabledByDefault>false</JsonSerializerIsReflectionEnabledByDefault>in my project - is that I get an error from thegrpcpackage used:Which I cannot figure out the actual cause of