Skip to content
This repository was archived by the owner on Mar 21, 2025. It is now read-only.

Turn on the AOT analyzer. #92

Merged
merged 6 commits into from
Mar 18, 2025
Merged

Conversation

eiriktsarpalis
Copy link
Collaborator

Turns on the AOT analyzer for the main projects.

Fix #59.

@PederHP
Copy link
Owner

PederHP commented Mar 17, 2025

AOT-related experience is a big gap of mine, sadly, so I don't have anything of value to add here, but following this with great interest.

@eiriktsarpalis eiriktsarpalis force-pushed the enable-aot branch 2 times, most recently from ca31f95 to 7811ab0 Compare March 18, 2025 12:06
@eiriktsarpalis
Copy link
Collaborator Author

@stephentoub I've rebased my changes on top of yours. Should be ready to go in now.

{
public static JsonSerializerOptions DefaultOptions { get; } = CreateDefaultOptions();

/// <summary>
/// Creates default options to use for MCP-related serialization.
/// </summary>
/// <returns>The configured options.</returns>
[UnconditionalSuppressMessage("AotAnalysis", "IL3050", Justification = "DefaultJsonTypeInfoResolver is only used when reflection-based serialization is enabled")]
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026", Justification = "DefaultJsonTypeInfoResolver is only used when reflection-based serialization is enabled")]
private static JsonSerializerOptions CreateDefaultOptions()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to create this as chained with AIJsonUtilities.DefaultOptions?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's something I considered but figured I should keep independent from a trimmability perspective. We can revisit if we think it's important. I'm gravitating towards a model where protocol DTOs hardcode the source generator and we only use JSO for tool calling.

stephentoub
stephentoub previously approved these changes Mar 18, 2025
@eiriktsarpalis
Copy link
Collaborator Author

@stephentoub Me pushing changes ended up dismissing your review, could you resubmit one please?

@eiriktsarpalis eiriktsarpalis merged commit e7fa619 into PederHP:main Mar 18, 2025
1 check passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Turn on the AOT analyzer for the main project
3 participants