Skip to content

feat: Initial AOT compatibility metadata#79

Open
BenjaminMichaelis wants to merge 11 commits into
mainfrom
benjaminmichaelis/nuget-aot-assessment
Open

feat: Initial AOT compatibility metadata#79
BenjaminMichaelis wants to merge 11 commits into
mainfrom
benjaminmichaelis/nuget-aot-assessment

Conversation

@BenjaminMichaelis
Copy link
Copy Markdown
Owner

Why

This starts the production-scope AOT compatibility work so consumers on modern .NET can use analyzer-backed targets while retaining existing netstandard compatibility.

What changed

  • Multi-targeted production libraries to netstandard2.1;net10.0:
    • VSTestPlaylistTools
    • VSTestPlaylistTools.TrxToPlaylistConverter
  • Enabled IsAotCompatible for VSTestPlaylistTools.TrxToPlaylistConverter on net8.0+ targets.
  • Updated README with the current AOT compatibility status and caveats.
  • Fixed nullable flow in playlist builders by using string? for Path.GetDirectoryName(...) results.

Notes for reviewers

VSTestPlaylistTools is intentionally not marked IsAotCompatible yet. Its XML serializer paths still rely on runtime XmlSerializer behavior, so full AOT compatibility for that package is a follow-up item.

Multi-target production libraries to netstandard2.1 and net10.0, enable IsAotCompatible for TrxToPlaylistConverter on net8+, and document current AOT status. Also fix nullable annotations for Path.GetDirectoryName in playlist builders.
Copilot AI review requested due to automatic review settings May 15, 2026 19:41
Copy link
Copy Markdown
Contributor

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 starts AOT-related packaging work by adding modern .NET targeting while preserving netstandard2.1 compatibility, and documents the current AOT status.

Changes:

  • Multi-targets the two production libraries to netstandard2.1;net10.0.
  • Adds conditional IsAotCompatible metadata to the TRX converter project.
  • Updates README AOT status and fixes nullable annotations for playlist output directories.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
VSTestPlaylistTools/VSTestPlaylistTools.csproj Adds net10.0 alongside netstandard2.1.
VSTestPlaylistTools/PlaylistV2/PlaylistV2Builder.cs Makes Path.GetDirectoryName(...) result nullable-aware.
VSTestPlaylistTools/PlaylistV1/PlaylistV1Builder.cs Makes Path.GetDirectoryName(...) result nullable-aware.
VSTestPlaylistTools.TrxToPlaylistConverter/VSTestPlaylistTools.TrxToPlaylistConverter.csproj Adds net10.0 targeting and conditional AOT compatibility metadata.
README.md Documents AOT compatibility status and caveats.
Comments suppressed due to low confidence (1)

VSTestPlaylistTools.TrxToPlaylistConverter/VSTestPlaylistTools.TrxToPlaylistConverter.csproj:11

  • Declaring this package AOT-compatible is not accurate while its public conversion methods call PlaylistV1Builder.SaveToFile/ToXmlString, which go through PlaylistRoot.Serialize and create XmlSerializer at runtime in VSTestPlaylistTools/PlaylistV1/PlaylistRoot.cs. That is the same runtime XML serialization path the PR notes exclude from AOT support for the main package, so consumers can get a false AOT-compatible signal and still fail or miss warnings when using these APIs under Native AOT.
  <PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">
    <IsAotCompatible>true</IsAotCompatible>
  </PropertyGroup>

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

Comment thread README.md Outdated
Add net8.0 target to TrxToPlaylistConverter so .NET 8/9 consumers resolve an AOT-analyzed asset, and update README wording to match actual target frameworks.
…mpatibility

- Remove all XmlSerializer usage from VSTestPlaylistTools V1 and V2 playlists
- Create PlaylistV2Serializer internal helper for recursive XML read/write
- Remove [XmlRoot]/[XmlAttribute]/[XmlElement]/[XmlIgnore] from model classes
- Enable IsAotCompatible=true on VSTestPlaylistTools for net8.0+
- Add AOT smoke test project (VSTestPlaylistTools.TrxToPlaylistConverter.AotSmokeTest)
- Add aot-compatibility CI job with publish, run, and nupkg TFM verification steps
- Fix BooleanRule Match attribute validation (throw on invalid/missing values)
- Fix XmlReader exception wrapping in FromXmlReader public methods
Replace TrxLib (netstandard2.1, non-AOT) with native System.Xml.Linq
TRX parsing and a new TestOutcome enum, making
VSTestPlaylistTools.TrxToPlaylistConverter truly AOT-compatible.

- Add TestOutcome.cs: public enum replacing TrxLib.TestOutcome
- Add TrxFileParser.cs: internal AOT-safe TRX parser via System.Xml.Linq
- Remove TrxLib PackageReference from the library project
- Update trx-to-vsplaylist to use the new TestOutcome enum
- Add explicit TrxLib ref to test project (for assertion helpers only)
The 'Verify nupkg TFMs' step used bash syntax (subshell assignment,
test, unzip) but the workflow default shell is pwsh, causing the step
to fail on ubuntu-latest with a 'not recognized as a cmdlet' error.

Add \shell: bash\ to that step so it runs under bash as intended.
Copy link
Copy Markdown
Contributor

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

Copilot reviewed 24 out of 24 changed files in this pull request and generated 10 comments.

Comment thread VSTestPlaylistTools/VSTestPlaylistTools.csproj
Comment thread VSTestPlaylistTools.TrxToPlaylistConverter/TrxFileParser.cs Outdated
Comment thread .github/workflows/build-and-test.yml Outdated
Comment thread .github/workflows/build-and-test.yml
Comment thread VSTestPlaylistTools.TrxToPlaylistConverter.AotSmokeTest/Program.cs
Comment thread VSTestPlaylistTools.TrxToPlaylistConverter/TestOutcome.cs
Comment thread VSTestPlaylistTools/PlaylistV1/PlaylistRoot.cs
Comment thread VSTestPlaylistTools/PlaylistV2/PlaylistRoot.cs
Comment thread VSTestPlaylistTools/PlaylistV2/PlaylistV2Serializer.cs
- Add missing TRX outcome values to TestOutcome enum (Error, Aborted,
  NotRunnable, Warning, Completed, InProgress, Disconnected)
- Skip results with unknown outcome strings in TrxFileParser instead of
  coercing to NotExecuted
- Throw InvalidOperationException in PlaylistV2Serializer.WriteRule for
  unrecognized Rule subclasses (prevent silent data loss)
- Update README to reflect both packages now carry IsAotCompatible metadata
- Fix CI: add -r linux-x64 to restore step for RID-specific assets
- Fix CI: restore converter project before pack to provide all TFM assets
- Add TRX parsing exercise to AOT smoke test (covers TrxFileParser.Parse)
- Add internal PlaylistXmlHelper with EnsureDirectory and StringToReader
  helpers; used by V1/V2 Builder (SaveToFile) and V1/V2 Parser (FromString)
- Use StringReader instead of MemoryStream+StreamReader for string->TextReader
  conversion (no unnecessary UTF-8 encode/decode round-trip)
- EnsureDirectory drops redundant Directory.Exists check; CreateDirectory is
  already idempotent
- Extract private FilterResults in TrxToPlaylistConverter, used by both
  ConvertTrxToPlaylist and ConvertMultipleTrxToPlaylist
@BenjaminMichaelis BenjaminMichaelis changed the title Add net10 multitargeting and initial AOT compatibility metadata feat: Add net10 multitargeting and initial AOT compatibility metadata May 16, 2026
@BenjaminMichaelis BenjaminMichaelis changed the title feat: Add net10 multitargeting and initial AOT compatibility metadata feat: Initial AOT compatibility metadata May 16, 2026
Without a net8.0 asset, .NET 8 consumers of VSTestPlaylistTools resolve the
netstandard2.1 fallback and never receive the IsAotCompatible=true metadata.
This aligns both library packages: netstandard2.1;net8.0;net10.0.
Copy link
Copy Markdown
Contributor

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

Copilot reviewed 25 out of 25 changed files in this pull request and generated 3 comments.

Comment thread VSTestPlaylistTools.TrxToPlaylistConverter/TestOutcome.cs
Comment thread README.md Outdated
Comment thread VSTestPlaylistTools.TrxToPlaylistConverter/TrxFileParser.cs Outdated
Copy link
Copy Markdown
Contributor

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

Copilot reviewed 25 out of 25 changed files in this pull request and generated 4 comments.

Comment thread README.md Outdated
Comment thread VSTestPlaylistTools.TrxToPlaylistConverter/TrxFileParser.cs Outdated
Comment thread trx-to-vsplaylist/Program.cs Outdated
Comment thread VSTestPlaylistTools.TrxToPlaylistConverter/TestOutcome.cs Outdated
- Update README AOT section so VSTestPlaylistTools target list includes net8.0
- Harden TRX outcome parsing with Enum.IsDefined to skip undefined numeric enum values
- Enforce Enum.IsDefined in CLI outcome parsing to reject undefined numeric values
- Add focused test covering --outcome 999 returning failure
- Improve NotRunnable XML-doc summary grammar in TestOutcome
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