Skip to content

Implementing nativeAOT - #1938

Open
belav wants to merge 2 commits into
mainfrom
nativeaot
Open

belav wants to merge 2 commits into
mainfrom
nativeaot

Conversation

@belav

@belav belav commented Nov 13, 2026

Copy link
Copy Markdown
Owner

closes #474

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.

🟡 Changes recommended

Windows native packages break formatting in released IDE plugins, while publishing retry failures and YAML configuration regressions also remain unresolved.

4 open issues
What changed in this PR

Implements NativeAOT support to reduce CSharpier’s startup cost, addressing #474’s single-file formatting performance goal while retaining managed builds.

Changes:

  • Replaces reflection-based serialization with AOT-compatible JSON contexts and explicit YAML parsing.
  • Adds native executable process tests and managed/native output comparisons.
  • Introduces runtime-specific tool packaging, release automation, and rollout documentation.
File Description
Src/​CSharpierProcess.Tests/​ServerTests.cs Supports testing a native server executable.
Src/​CSharpierProcess.Tests/​CSharpierExecutable.cs Centralizes managed/native executable selection.
Src/​CSharpierProcess.Tests/​CliTests.cs Adds compatibility scenarios and executable selection.
Src/​CSharpier.Tests/​Cli/​Options/​CSharpierConfigParserTests.cs Expands YAML and JSON configuration coverage.
Src/​CSharpier.Tests/​Cli/​FormattingCacheTests.cs Checks cache-key serialization compatibility.
Src/​CSharpier.MsBuild/​CSharpier.MsBuild.csproj Excludes runtime-specific outputs from managed packaging.
Src/​CSharpier.Core/​Xml/​RawNodeSyntaxWriter.cs Uses source-generated XML-node serialization.
Src/​CSharpier.Core/​Xml/​RawNode.cs Uses an AOT-compatible enum converter.
Src/​CSharpier.Core/​DebugLogger.cs Removes reflection-based object logging.
Src/​CSharpier.Core/​CSharpier.Core.csproj Enables AOT compatibility checks for supported targets.
Src/​CSharpier.Core/​CSharp/​CSharpFormatter.cs Uses JSON nodes for syntax-tree output.
Src/​CSharpier.Cli/​Server/​ServerFormatter.cs Uses generated request and response serialization.
Src/​CSharpier.Cli/​Server/​FormatFileResult.cs Uses an AOT-compatible status converter.
Src/​CSharpier.Cli/​Options/​CSharpierConfigParser.cs Adds explicit YAML mapping and generated JSON parsing.
Src/​CSharpier.Cli/​Options/​ConfigurationFileOptions.cs Makes configuration properties writable for serialization.
Src/​CSharpier.Cli/​FormattingCache.cs Uses generated cache serialization.
Src/​CSharpier.Cli/​CSharpier.Cli.csproj Enables native publishing and runtime-specific packages.
Src/​CSharpier.Cli/​CliJsonContext.cs Defines generated CLI and configuration JSON contexts.
Scripts/​CompareManagedAndNative.ps1 Compares managed/native formatting results and output.
openspec/​changes/​native-aot-tool/​tasks.md Tracks implementation and rollout tasks.
openspec/​changes/​native-aot-tool/​specs/​native-aot-distribution/​spec.md Defines distribution and compatibility requirements.
openspec/​changes/​native-aot-tool/​proposal.md Describes motivation, scope, and impact.
openspec/​changes/​native-aot-tool/​design.md Records design decisions, benchmarks, and rollout constraints.
openspec/​changes/​native-aot-tool/​.openspec.yaml Adds change metadata.
.github/​workflows/​ValidatePullRequest.yml Adds native publishing and compatibility validation.
.github/​workflows/​publish_nuget.yml Adds multi-platform packaging and coordinated publication.

Review effort: Balanced

Comment thread Src/CSharpier.Cli/CSharpier.Cli.csproj Resolved
runs-on: ubuntu-latest
name: publish nuget
needs: test
needs: [ test, check-version, pack-native, pack-pointer ]
Comment on lines +98 to +103
var overrides = new List<Override>();
if (FindValue(root, "overrides") is YamlSequenceNode overrideNodes)
{
foreach (var overrideNode in overrideNodes.OfType<YamlMappingNode>())
{
overrides.Add(
Comment on lines +200 to +204
return bool.TryParse(value, out var result)
? result
: throw new InvalidOperationException(
$"The value '{value}' for '{key}' is not a valid boolean."
);
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.

NativeAOT to improve performance for formatting a single file

2 participants