Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR resolves warnings and fixes issues for Native AOT compilation by adding proper attributes and runtime checks to support both JIT and AOT scenarios.
Changes:
- Added
UnconditionalSuppressMessageattributes to suppress IL2* and IL3* AOT analysis warnings where reflection is acceptable - Added
DynamicallyAccessedMembersannotations to types requiring reflection support - Added
RuntimeFeature.IsDynamicCodeCompiledguards to prevent runtime code generation in AOT scenarios - Enhanced the generator to create formatters for inherited collection interfaces (ILookup, IGrouping)
- Made nullable annotation improvements and refactored collection type metadata organization
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/CsToml.Extensions.Configuration.Tests/TypeDeclarations.cs | Made Integers property nullable to match actual usage |
| src/CsToml/Formatter/TypeFormatter.cs | Added IL2057 suppression for Type.GetType reflection usage |
| src/CsToml/Formatter/Resolver/TomlSerializedObjectFormatterResolver.cs | Added IL2090 suppression for ITomlSerializedObjectRegister invocation |
| src/CsToml/Formatter/Resolver/BuiltinFormatterResolver.cs | Added IL3050 suppressions and RuntimeFeature checks to prevent dynamic code generation in AOT |
| src/CsToml/Formatter/EnumFormatter.cs | Added DynamicallyAccessedMembers annotation for enum field reflection |
| src/CsToml.Generator/TypeMeta.cs | Enhanced type discovery to include public generic collection interfaces |
| src/CsToml.Generator/Generator.cs | Added null-forgiving operators after validated non-null checks |
| src/CsToml.Generator/FormatterTypeMetaData.cs | Reorganized collection types, moved FrozenSet to concrete types, added interface collection support |
| sandbox/ConsoleNativeAOT/Type.cs | Added TypeLinqInterface test class for ILookup and IGrouping formatters |
| sandbox/ConsoleNativeAOT/Program.cs | Added test code for TypeLinqInterface serialization |
| sandbox/ConsoleNativeAOT/ConsoleNativeAOT.csproj | Updated to .NET 10.0 and adjusted AOT properties |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Merged
This was referenced Jan 12, 2026
This was referenced Jan 19, 2026
This was referenced Jan 27, 2026
This was referenced Feb 3, 2026
This was referenced Feb 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR resolve warnings and fix issues in Native AOT builds.
UnconditionalSuppressMessageAttribute(suppressing the IL3* and IL2* warnings)EnumFormatterRuntimeFeature.IsDynamicCodeCompiledto some reflectionsFormatterfor the inherited collection interface.