You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Yes, I'm writing a WinUI 3 Application (using Windows App SDK) which must be published as trimmed since .NET supports it, but the Microsoft.Graph dependency does not support it and give me trim warnings.
Describe the solution you'd like
Fix all cases using reflection and every single trim warning to make the SDK fully trimmable.
This is a requirement for Native AOT which is coming soon for Windows App SDK with .NET 8.
Full list of trim warnings for version 5.25.0.
1>ILLink : Trim analysis warning IL2075: Microsoft.Graph.DriveItemRequestBuilderExtensions.GetPathParameters(Object): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.NonPublicFields' in call to 'System.Type.GetFields(BindingFlags)'. The return value of method 'System.Type.BaseType.get' 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.
1>ILLink : Trim analysis warning IL2075: Microsoft.Graph.DriveItemRequestBuilderExtensions.GetRequestAdapter(Object): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.NonPublicFields' in call to 'System.Type.GetFields(BindingFlags)'. The return value of method 'System.Type.BaseType.get' 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.
1>ILLink : Trim analysis warning IL2075: Microsoft.Graph.DriveItemRequestBuilderExtensions.GetUrlTemplate(Object): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.NonPublicFields' in call to 'System.Type.GetFields(BindingFlags)'. The return value of method 'System.Type.BaseType.get' 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.
1>ILLink : Trim analysis warning IL2075: Microsoft.Graph.DriveItemRequestBuilderExtensions.UpdateUrlTemplate<T>(T, String): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.NonPublicFields' in call to 'System.Type.GetFields(BindingFlags)'. The return value of method 'System.Type.BaseType.get' 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.
1>ILLink : Trim analysis warning IL2026: Microsoft.Graph.DeltaResponseHandler<T>.<GetResponseString>d__3.MoveNext(): Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(TValue, 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.
1>ILLink : Trim analysis warning IL2026: Microsoft.Graph.DeltaResponseHandler<T>.<HandleResponseAsync>d__2<NativeResponseType,ModelType>.MoveNext(): Using member 'System.Text.Json.JsonSerializer.Deserialize<TValue>(Stream, 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.
1>ILLink : Trim analysis warning IL2026: Microsoft.Graph.ResponseHandler<T>.<HandleResponseAsync>d__2<NativeResponseType,ModelType>.MoveNext(): Using member 'System.Text.Json.JsonSerializer.Deserialize<TValue>(Stream, 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.
1>ILLink : Trim analysis warning IL2026: Microsoft.Graph.AsyncMonitor<T>.<PollForOperationCompletionAsync>d__4.MoveNext(): Using member 'System.Text.Json.JsonSerializer.DeserializeAsync<TValue>(Stream, JsonSerializerOptions, CancellationToken)' 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.
1>ILLink : Trim analysis warning IL2026: Microsoft.Graph.AsyncMonitor<T>.<PollForOperationCompletionAsync>d__4.MoveNext(): Using member 'System.Text.Json.JsonSerializer.DeserializeAsync<TValue>(Stream, JsonSerializerOptions, CancellationToken)' 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.
1>ILLink : Trim analysis warning IL2026: Microsoft.Graph.DeltaResponseHandler<T>.AddOrReplacePropertyToObject(JsonElement, String, Object): Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(TValue, 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.
1>ILLink : Trim analysis warning IL2026: Microsoft.Graph.DeltaResponseHandler<T>.AddOrReplacePropertyToObject(JsonElement, String, Object): Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(TValue, 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.
1>ILLink : Trim analysis warning IL2075: Microsoft.Graph.LargeFileUploadTask<T>.ExtractSessionFromParsable(IParsable): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in call to 'System.Type.GetProperty(String)'. 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.
1>ILLink : Trim analysis warning IL2075: Microsoft.Graph.LargeFileUploadTask<T>.ExtractSessionFromParsable(IParsable): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in call to 'System.Type.GetProperty(String)'. 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.
1>ILLink : Trim analysis warning IL2075: Microsoft.Graph.LargeFileUploadTask<T>.ExtractSessionFromParsable(IParsable): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in call to 'System.Type.GetProperty(String)'. 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.
1>ILLink : Trim analysis warning IL2075: Microsoft.Graph.PageIterator<TEntity,TCollectionPage>.ExtractEntityListFromParsable(PageIterator<TEntity,TCollectionPage>.TCollectionPage): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in call to 'System.Type.GetProperty(String)'. 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.
1>ILLink : Trim analysis warning IL2075: Microsoft.Graph.PageIterator<TEntity,TCollectionPage>.ExtractNextLinkFromParsable(PageIterator<TEntity,TCollectionPage>.TCollectionPage, String): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in call to 'System.Type.GetProperty(String)'. 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.
Describe alternatives you've considered
The alternative would be not using the .NET SDK but using REST API instead, but we should strive to improve the SDK instead.
Additional context
I have a sample application here which has a WinUI 3 C# App publishing as trimmed with Microsoft.Graph dependencies which can be used to check all warning generated even in Debug mode.
Is your feature request related to a problem? Please describe.
Yes, I'm writing a WinUI 3 Application (using Windows App SDK) which must be published as trimmed since .NET supports it, but the
Microsoft.Graph
dependency does not support it and give me trim warnings.Describe the solution you'd like
Fix all cases using reflection and every single trim warning to make the SDK fully trimmable.
This is a requirement for Native AOT which is coming soon for Windows App SDK with .NET 8.
Full list of trim warnings for version
5.25.0
.Describe alternatives you've considered
The alternative would be not using the .NET SDK but using REST API instead, but we should strive to improve the SDK instead.
Additional context
I have a sample application here which has a WinUI 3 C# App publishing as trimmed with
Microsoft.Graph
dependencies which can be used to check all warning generated even in Debug mode.The text was updated successfully, but these errors were encountered: