Skip to content
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

Trimming warning in JsonSerializationWriter due to call to 'System.Object.GetType()' #475

Open
andrueastman opened this issue Nov 18, 2024 · 0 comments
Labels
priority:p2 Medium. For a p2 bug, generally have a work-around. Bug SLA <=30 days type: bug A broken experience

Comments

@andrueastman
Copy link
Member

The call to object.GetType() in the line below generates a trim warning.

foreach(var oProp in value.GetType().GetProperties())

The warning is as seen in this PR - microsoftgraph/msgraph-sdk-dotnet-core#939

ILC : Trim analysis error IL2075: Microsoft.Kiota.Serialization.Json.JsonSerializationWriter.WriteNonParsableObjectValue(String,!!0): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in call to 'System.Type.GetProperties()'. The return value of method 'System.Object.GetType()' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.

The trim warning could be alleviated using typeof(T) instead of object.GetType(), however, this would break currently supported serialization of types unknown at compile time(such as when a non parsable object is placed in the AdditionalData bag.)

For now, we probably need to

@github-project-automation github-project-automation bot moved this to Needs Triage 🔍 in Kiota Nov 18, 2024
@andrueastman andrueastman moved this from Needs Triage 🔍 to Todo 📃 in Kiota Nov 18, 2024
@baywet baywet added type: bug A broken experience priority:p2 Medium. For a p2 bug, generally have a work-around. Bug SLA <=30 days labels Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority:p2 Medium. For a p2 bug, generally have a work-around. Bug SLA <=30 days type: bug A broken experience
Projects
Status: New📃
Development

No branches or pull requests

2 participants