Skip to content

fix IL trimming warnings #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

Stepami
Copy link
Contributor

@Stepami Stepami commented May 5, 2025

Using JsonSerializer.Serialize{TValue}(TValue, JsonTypeInfo{TValue}) overload to avoid IL warnings

Info:

  • Validly 1.1.5

Still have trouble publishing AOT:

    ILC : Trim analysis warning IL2026: Validly.ValidationMessage.<>c.<.ctor>b__0_0(Object): Using member 'System.Text.Json.JsonSerializer.Serialize<Object>(Object,JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.
    ILC : AOT analysis warning IL3050: Validly.ValidationMessage.<>c.<.ctor>b__0_0(Object): Using member 'System.Text.Json.JsonSerializer.Serialize<Object>(Object,JsonSerializerOptions)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.

@Stepami
Copy link
Contributor Author

Stepami commented May 6, 2025

@Hookyns what is package version update strategy now?

@Hookyns
Copy link
Owner

Hookyns commented May 7, 2025

I'd like to run some tests related to this. For now, I published it as 1.1.6-rc.1

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