-
Notifications
You must be signed in to change notification settings - Fork 40
Description
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
- Suppress the trim warning in the json serializer source so as to continue support for serializing non parsable object unkown at compile time.
- Setup CI similar to this so that trimming warnings are checked on every PR. https://github.com/microsoftgraph/msgraph-sdk-dotnet-core/blob/72aa793b90964335c051d7ba1c06d2f9f6aa5524/.github/workflows/validatePullRequest.yml#L59
Metadata
Metadata
Assignees
Labels
Type
Projects
Status