Skip to content

chore: Fix trimmer warnings - #2954

Merged
jonpryor merged 1 commit into
mainfrom
dev/jonpryor/jonp-fix-trimmer-warnings
Dec 3, 2025
Merged

chore: Fix trimmer warnings#2954
jonpryor merged 1 commit into
mainfrom
dev/jonpryor/jonp-fix-trimmer-warnings

Conversation

@jonpryor

@jonpryor jonpryor commented Nov 21, 2025

Copy link
Copy Markdown
Contributor

Context: dotnet/runtime#121629
Context: dea3b57 / 56a003b [may not exist]
Context: c3c4c78

Enable $(IsAotCompatible)=true for the following projects:

  • src/Uno.Extensions.Core/Uno.Extensions.Core.csproj
  • src/Uno.Extensions.Navigation/Uno.Extensions.Navigation.csproj
  • src/Uno.Extensions.Reactive/Uno.Extensions.Reactive.csproj

Fix the following warnings-as-errors:

src/Uno.Extensions.Core/DependencyInjection/ServiceCollectionExtensions.cs(24,3): error IL2091:
  'TService' generic argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicConstructors' in 'Microsoft.Extensions.DependencyInjection.Extensions.ServiceCollectionDescriptorExtensions.TryAddTransient<TService>(IServiceCollection)'.
  The generic parameter 'TImplementation' of 'Uno.Extensions.ServiceCollectionExtensions.AddNamedSingleton<TService, TImplementation>(IServiceCollection, String)' 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.
src/Uno.Extensions.Navigation/MappedViewMap.cs(14,6): error IL2067:
  'ViewModel' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicConstructors' in call to 'Uno.Extensions.Navigation.ViewMap.ViewMap(Type, Func<Type>, Type, DataMap, Type, Object)'.
  The parameter 'ViewModel' of method 'Uno.Extensions.Navigation.MappedViewMap.MappedViewMap(Type, Func<Type>, Type, DataMap, Type, Type)' 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.
src/Uno.Extensions.Navigation/ViewMap.cs(66,5): error IL2087:
  'ViewModel' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicConstructors' in call to 'Uno.Extensions.Navigation.ViewMap<TView>.ViewMap(Type, DataMap, Type, Object)'.
  The generic parameter 'TViewModel' of 'Uno.Extensions.Navigation.ViewMap<TView, TViewModel>' 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.
src/Uno.Extensions.Navigation/ViewMap.cs(86,15): error IL2091:
  'TViewModel' generic argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicConstructors' in 'Uno.Extensions.Navigation.ViewMap<TView, TViewModel>'.
  The generic parameter 'TViewModel' of 'Uno.Extensions.Navigation.ResultDataViewMap<TView, TViewModel, TResultData>' 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.
src/Uno.Extensions.Reactive/Presentation/Bindings/BindableViewModelBase.HotReload.cs(102,15): error IL2067:
  'updatedModelType' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicConstructors' in call to 'Uno.Extensions.Reactive.Bindings.BindableViewModelBase.__Reactive_CreateModelInstance(Type)'.
  The parameter 'updatedModelType' of method 'Uno.Extensions.Reactive.Bindings.BindableViewModelBase.HotPatch(Type, Type)' 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.
src/Uno.Extensions.Reactive/Collections/Facades/Map/LockedMemoizedConverter.cs(20,75): error IL2091:
  'TValue' generic argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicParameterlessConstructor' in 'System.Runtime.CompilerServices.ConditionalWeakTable<TKey, TValue>'.
  The generic parameter 'TFrom' of 'Uno.Extensions.Conversion.LockedMemoizedConverter<TFrom, TTo>' 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.
…
src/Uno.Extensions.Reactive/Collections/Facades/Map/OneWayMemoizedConverter.cs(19,75): error IL2091:
  'TValue' generic argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicParameterlessConstructor' in 'System.Runtime.CompilerServices.ConditionalWeakTable<TKey, TValue>'.
  The generic parameter 'TFrom' of 'Uno.Extensions.Conversion.OneWayMemoizedConverter<TFrom, TTo>' 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.
…
src/Uno.Extensions.Reactive/Presentation/Bindings/BindableViewModelBase.HotReload.cs(405,41): error IL2070:
  'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.Interfaces' in call to 'System.Type.GetInterfaces()'.
  The parameter 'type' of method 'Uno.Extensions.Reactive.Bindings.BindableViewModelBase.IsFeed(Type, out Type)' 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.

Add the missing [DynamicallyAccessedMembers].

Address the following warnings-as-errors:

src/Uno.Extensions.Navigation/ViewMap.cs(44,5): error IL2067:
  'ViewModel' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicConstructors' in call to 'Uno.Extensions.Navigation.ViewMap.ViewMap(Type, Func<Type>, Type, DataMap, Type, Object)'.
  The parameter 'Data' of method 'Uno.Extensions.Navigation.ViewMap<TView>.ViewMap(Type, DataMap, Type, Object)' 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.

This is dotnet/runtime#121629. Work around it by providing the
ViewSelector: null parameter.

Address the following warning-as-errors:

src/Uno.Extensions.Reactive/Presentation/Bindings/BindableViewModelBase.HotReload.cs(353,31): error IL3050:
  Using member 'System.Type.MakeGenericType(params Type[])' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling.
  The native code for this instantiation might not be available at runtime.
src/Uno.Extensions.Reactive/Presentation/Bindings/BindableViewModelBase.HotReload.cs(357,31): error IL3050:
  Using member 'System.Type.MakeGenericType(params Type[])' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling.
  The native code for this instantiation might not be available at runtime.
src/Uno.Extensions.Reactive/Presentation/Bindings/BindableViewModelBase.HotReload.cs(349,31): error IL3050:
  Using member 'System.Type.MakeGenericType(params Type[])' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling.
  The native code for this instantiation might not be available at runtime.

Add [RequiresDynamicCode] to "forward" the IL3050 to callers.

Suppress the following warning-as-error:

src/Uno.Extensions.Reactive/Presentation/Bindings/BindableViewModelBase.HotReload.cs(394,30): error IL2072:
  'type' argument does not satisfy 'DynamicallyAccessedMemberTypes.Interfaces' in call to 'Uno.Extensions.Reactive.Bindings.BindableViewModelBase.IsFeed(Type, out Type)'.
  The return value of method 'System.Reflection.PropertyInfo.PropertyType.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.

This IL2072 is "forwarded" from an above change to IsFeed(), and I
don't know how to properly forward or address at this callsite.

Suppress the following warning-as-error:

src/Uno.Extensions.Reactive/Core/HotReload/HotReloadService.cs(11,12): error IL2026:
  Using member 'Uno.Extensions.Reactive.Core.HotReload.HotReloadService.UpdateApplication(Type[])' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code.
  `MetadataUpdateOriginalTypeAttribute` may be a per-assembly type, so it cannot be statically known.

This is on an [assembly:]-level attribute. I can think of only
using #pragma warning disable to remove the error.

Suppress the following warning-as-error:

src/Uno.Extensions.Navigation/RouteInfo.cs(27,29): error IL2073:
  'Uno.Extensions.Navigation.RouteInfo.RenderView.get' method return value does not satisfy 'DynamicallyAccessedMemberTypes.PublicParameterlessConstructor' requirements.
  The return value of method 'System.Func<TResult>.Invoke()' 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.

Remember 56a003b (which has the comment, merged into dea3b57)?

Add [DynamicallyAccessedMembers] to RouteInfo.RenderView. This
is a bit of a lie, as RenderView invokes View…:

and there is no way to update the View parameter to assert that the
returned Type fulfills the requirements. Oddly, this doesn't require
suppressing anything…

Now it needs suppressing. We can't change the parameter type without
incurring an ABI break.

TODO: use constructor overloading?
Look into System.Runtime.CompilerServices.OverloadResolutionPriority.

For the following warning-as-errors:

src/Uno.Extensions.Navigation/NavigationRequestExtensions.cs(115,30): error IL2060:
  Call to 'System.Reflection.MethodInfo.MakeGenericMethod(params Type[])' can not be statically analyzed.
  It's not possible to guarantee the availability of requirements of the generic method.
src/Uno.Extensions.Navigation/NavigationRequestExtensions.cs(115,30): error IL3050:
  Using member 'System.Reflection.MethodInfo.MakeGenericMethod(params Type[])' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling.
  The native code for this instantiation might not be available at runtime.

This was apparently added in c3c4c78.

For now, "suppress and wrap" the warning: the warning is suppressed,
and we "wrap" in [RequiresDynamicCode].

Address the following warning-as-error:

src/Uno.Extensions.Http/ServiceCollectionExtensions.cs(117,15): error IL3050:
  Using member 'Microsoft.Extensions.Configuration.ConfigurationBinder.Get<T>(IConfiguration)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling.
  Binding strongly typed objects to configuration values requires generating dynamic code at runtime, for example instantiating generic types.

TODO: understand why generics were added to this codepath, and
possibly remove them? At a glance, the generics don't appear to be
publicly visible…

For now, Add [RequiresUnreferencedCode] to AddClientWithEndpoint().

Address the following warnings-as-errors:

src/Uno.Extensions.Reactive/Core/HotReload/HotReloadService.cs(69,8): error IL2075:
  '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.

The reflection use is required, and this is part of the
HotReload codepath, so annotate with [RequiresUnreferencedCode].

Address the following warnings-as-errors:

src/Uno.Extensions.Serialization/SystemTextJsonSerializer.cs(86,85): error IL3050:
  Using member 'System.Text.Json.JsonSerializer.Serialize(Object, Type, 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.
src/Uno.Extensions.Serialization/SystemTextJsonSerializer.cs(104,89): error IL3050:
  Using member 'System.Text.Json.JsonSerializer.Deserialize(String, Type, 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.
src/Uno.Extensions.Reactive/Presentation/Bindings/BindableViewModelBase.HotReload.cs(403,41): error IL2070:
  'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.Interfaces' in call to 'System.Type.GetInterfaces()'.
  The parameter 'type' of method 'Uno.Extensions.Reactive.Bindings.BindableViewModelBase.IsFeed(Type, out Type)' 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.

Add [RequiresDynamicCodeAttribute] or [RequiresUnreferencedCode],
depending on the warning message.

@jonpryor
jonpryor force-pushed the dev/jonpryor/jonp-fix-trimmer-warnings branch 2 times, most recently from ef159b3 to e4157bf Compare November 26, 2025 18:50
@jonpryor
jonpryor marked this pull request as ready for review November 26, 2025 18:51
@jonpryor jonpryor changed the title fix(trimmer): Fix trimmer warnings chore: Fix trimmer warnings Nov 26, 2025
Context: dotnet/runtime#121629
Context: dea3b57 / 56a003b [may not exist]
Context: c3c4c78

Enable `$(IsAotCompatible)`=true for the following projects:

  * `src/Uno.Extensions.Core/Uno.Extensions.Core.csproj`
  * `src/Uno.Extensions.Navigation/Uno.Extensions.Navigation.csproj`
  * `src/Uno.Extensions.Reactive/Uno.Extensions.Reactive.csproj`

Fix the following warnings-as-errors:

	src/Uno.Extensions.Core/DependencyInjection/ServiceCollectionExtensions.cs(24,3): error IL2091:
	  'TService' generic argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicConstructors' in 'Microsoft.Extensions.DependencyInjection.Extensions.ServiceCollectionDescriptorExtensions.TryAddTransient<TService>(IServiceCollection)'.
	  The generic parameter 'TImplementation' of 'Uno.Extensions.ServiceCollectionExtensions.AddNamedSingleton<TService, TImplementation>(IServiceCollection, String)' 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.
	src/Uno.Extensions.Navigation/MappedViewMap.cs(14,6): error IL2067:
	  'ViewModel' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicConstructors' in call to 'Uno.Extensions.Navigation.ViewMap.ViewMap(Type, Func<Type>, Type, DataMap, Type, Object)'.
	  The parameter 'ViewModel' of method 'Uno.Extensions.Navigation.MappedViewMap.MappedViewMap(Type, Func<Type>, Type, DataMap, Type, Type)' 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.
	src/Uno.Extensions.Navigation/ViewMap.cs(66,5): error IL2087:
	  'ViewModel' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicConstructors' in call to 'Uno.Extensions.Navigation.ViewMap<TView>.ViewMap(Type, DataMap, Type, Object)'.
	  The generic parameter 'TViewModel' of 'Uno.Extensions.Navigation.ViewMap<TView, TViewModel>' 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.
	src/Uno.Extensions.Navigation/ViewMap.cs(86,15): error IL2091:
	  'TViewModel' generic argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicConstructors' in 'Uno.Extensions.Navigation.ViewMap<TView, TViewModel>'.
	  The generic parameter 'TViewModel' of 'Uno.Extensions.Navigation.ResultDataViewMap<TView, TViewModel, TResultData>' 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.
	src/Uno.Extensions.Reactive/Presentation/Bindings/BindableViewModelBase.HotReload.cs(102,15): error IL2067:
	  'updatedModelType' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicConstructors' in call to 'Uno.Extensions.Reactive.Bindings.BindableViewModelBase.__Reactive_CreateModelInstance(Type)'.
	  The parameter 'updatedModelType' of method 'Uno.Extensions.Reactive.Bindings.BindableViewModelBase.HotPatch(Type, Type)' 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.
	src/Uno.Extensions.Reactive/Collections/Facades/Map/LockedMemoizedConverter.cs(20,75): error IL2091:
	  'TValue' generic argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicParameterlessConstructor' in 'System.Runtime.CompilerServices.ConditionalWeakTable<TKey, TValue>'.
	  The generic parameter 'TFrom' of 'Uno.Extensions.Conversion.LockedMemoizedConverter<TFrom, TTo>' 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.
	…
	src/Uno.Extensions.Reactive/Collections/Facades/Map/OneWayMemoizedConverter.cs(19,75): error IL2091:
	  'TValue' generic argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicParameterlessConstructor' in 'System.Runtime.CompilerServices.ConditionalWeakTable<TKey, TValue>'.
	  The generic parameter 'TFrom' of 'Uno.Extensions.Conversion.OneWayMemoizedConverter<TFrom, TTo>' 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.
	…
	src/Uno.Extensions.Reactive/Presentation/Bindings/BindableViewModelBase.HotReload.cs(405,41): error IL2070:
	  'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.Interfaces' in call to 'System.Type.GetInterfaces()'.
	  The parameter 'type' of method 'Uno.Extensions.Reactive.Bindings.BindableViewModelBase.IsFeed(Type, out Type)' 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.

Add the missing `[DynamicallyAccessedMembers]`.

Address the following warnings-as-errors:

	src/Uno.Extensions.Navigation/ViewMap.cs(44,5): error IL2067:
	  'ViewModel' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicConstructors' in call to 'Uno.Extensions.Navigation.ViewMap.ViewMap(Type, Func<Type>, Type, DataMap, Type, Object)'.
	  The parameter 'Data' of method 'Uno.Extensions.Navigation.ViewMap<TView>.ViewMap(Type, DataMap, Type, Object)' 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.

This is dotnet/runtime#121629.  Work around it by providing the
`ViewSelector: null` parameter.

Address the following warning-as-errors:

	src/Uno.Extensions.Reactive/Presentation/Bindings/BindableViewModelBase.HotReload.cs(353,31): error IL3050:
	  Using member 'System.Type.MakeGenericType(params Type[])' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling.
	  The native code for this instantiation might not be available at runtime.
	src/Uno.Extensions.Reactive/Presentation/Bindings/BindableViewModelBase.HotReload.cs(357,31): error IL3050:
	  Using member 'System.Type.MakeGenericType(params Type[])' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling.
	  The native code for this instantiation might not be available at runtime.
	src/Uno.Extensions.Reactive/Presentation/Bindings/BindableViewModelBase.HotReload.cs(349,31): error IL3050:
	  Using member 'System.Type.MakeGenericType(params Type[])' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling.
	  The native code for this instantiation might not be available at runtime.

Add `[RequiresDynamicCode]` to "forward" the IL3050 to callers.

Suppress the following warning-as-error:

	src/Uno.Extensions.Reactive/Presentation/Bindings/BindableViewModelBase.HotReload.cs(394,30): error IL2072:
	  'type' argument does not satisfy 'DynamicallyAccessedMemberTypes.Interfaces' in call to 'Uno.Extensions.Reactive.Bindings.BindableViewModelBase.IsFeed(Type, out Type)'.
	  The return value of method 'System.Reflection.PropertyInfo.PropertyType.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.

This IL2072 is "forwarded" from an above change to `IsFeed()`, and I
don't know how to properly forward or address at this callsite.

Suppress the following warning-as-error:

	src/Uno.Extensions.Reactive/Core/HotReload/HotReloadService.cs(11,12): error IL2026:
	  Using member 'Uno.Extensions.Reactive.Core.HotReload.HotReloadService.UpdateApplication(Type[])' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code.
	  `MetadataUpdateOriginalTypeAttribute` may be a per-assembly type, so it cannot be statically known.

This is on an `[assembly:]`-level attribute.  I can think of only
using `#pragma warning disable` to remove the error.

Suppress the following warning-as-error:

	src/Uno.Extensions.Navigation/RouteInfo.cs(27,29): error IL2073:
	  'Uno.Extensions.Navigation.RouteInfo.RenderView.get' method return value does not satisfy 'DynamicallyAccessedMemberTypes.PublicParameterlessConstructor' requirements.
	  The return value of method 'System.Func<TResult>.Invoke()' 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.

Remember 56a003b (which has the comment, merged into dea3b57)?

> Add `[DynamicallyAccessedMembers]` to `RouteInfo.RenderView`.  This
> is a bit of a lie, as `RenderView` invokes `View`…:
> …
> and there is no way to update the `View` parameter to assert that the
> returned `Type` fulfills the requirements.  Oddly, this doesn't require
> suppressing anything…

*Now* it needs suppressing.  We can't change the parameter type without
incurring an ABI break.

TODO: use constructor overloading?
Look into `System.Runtime.CompilerServices.OverloadResolutionPriority`.

For the following warning-as-errors:

	src/Uno.Extensions.Navigation/NavigationRequestExtensions.cs(115,30): error IL2060:
	  Call to 'System.Reflection.MethodInfo.MakeGenericMethod(params Type[])' can not be statically analyzed.
	  It's not possible to guarantee the availability of requirements of the generic method.
	src/Uno.Extensions.Navigation/NavigationRequestExtensions.cs(115,30): error IL3050:
	  Using member 'System.Reflection.MethodInfo.MakeGenericMethod(params Type[])' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling.
	  The native code for this instantiation might not be available at runtime.

This was apparently added in c3c4c78.

For now, "suppress and wrap" the warning: the warning is suppressed,
and we "wrap" in `[RequiresDynamicCode]`.

Address the following warning-as-error:

	src/Uno.Extensions.Http/ServiceCollectionExtensions.cs(117,15): error IL3050:
	  Using member 'Microsoft.Extensions.Configuration.ConfigurationBinder.Get<T>(IConfiguration)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling.
	  Binding strongly typed objects to configuration values requires generating dynamic code at runtime, for example instantiating generic types.

TODO: understand why generics were added to this codepath, and
possibly *remove* them?  At a glance, the generics don't appear to be
publicly visible…

For now, Add `[RequiresUnreferencedCode]` to `AddClientWithEndpoint()`.

Address the following warnings-as-errors:

	src/Uno.Extensions.Reactive/Core/HotReload/HotReloadService.cs(69,8): error IL2075:
	  '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.

The reflection use is required, and this is part of the
HotReload codepath, so annotate with `[RequiresUnreferencedCode]`.

Address the following warnings-as-errors:

	src/Uno.Extensions.Serialization/SystemTextJsonSerializer.cs(86,85): error IL3050:
	  Using member 'System.Text.Json.JsonSerializer.Serialize(Object, Type, 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.
	src/Uno.Extensions.Serialization/SystemTextJsonSerializer.cs(104,89): error IL3050:
	  Using member 'System.Text.Json.JsonSerializer.Deserialize(String, Type, 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.
	src/Uno.Extensions.Reactive/Presentation/Bindings/BindableViewModelBase.HotReload.cs(403,41): error IL2070:
	  'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.Interfaces' in call to 'System.Type.GetInterfaces()'.
	  The parameter 'type' of method 'Uno.Extensions.Reactive.Bindings.BindableViewModelBase.IsFeed(Type, out Type)' 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.

Add `[RequiresDynamicCodeAttribute]` or `[RequiresUnreferencedCode]`,
depending on the warning message.
@jonpryor
jonpryor force-pushed the dev/jonpryor/jonp-fix-trimmer-warnings branch from e4157bf to f4198de Compare December 1, 2025 21:10
@jonpryor
jonpryor requested a review from dr1rrb December 1, 2025 21:11
@jonpryor
jonpryor enabled auto-merge December 3, 2025 12:30
@jonpryor
jonpryor merged commit cd3e976 into main Dec 3, 2025
14 of 15 checks passed
@jonpryor
jonpryor deleted the dev/jonpryor/jonp-fix-trimmer-warnings branch December 3, 2025 12:31
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