I'm trying to compile and publish my .NET MAUI app using Native AOT and trying to fix AOT warnings. Instead of calling
[RequiresUnreferencedCode("This method requires ''DynamicallyAccessedMemberTypes.All' on the runtime type of 'obj'.")]
public Task<int> UpdateAsync(object obj)
I'm calling
public Task<int> UpdateAsync(object obj, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type objType)
and due to DynamicallyAccessedMembers the linker preserves by type I pass to the call. That works out OK and no trimmer warning is produced.
Now I try to do the same for InsertAllAsync():
[RequiresUnreferencedCode("This method requires ''DynamicallyAccessedMemberTypes.All' on the runtime type of all objects in 'objects'.")]
public Task<int> InsertAllAsync(IEnumerable objects, bool runInTransaction = true)
The replacement would be
[RequiresUnreferencedCode("This method requires ''DynamicallyAccessedMemberTypes.All' on the runtime type of all objects in 'objects'.")]
public Task<int> InsertAllAsync(IEnumerable objects, Type objType, bool runInTransaction = true)
Unfortunately, it is also marked with [RequiresUnreferencedCode]. I think the Type parameter should be marked with [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] instead, like in the UpdateAsync() method:
public Task<int> InsertAllAsync(IEnumerable objects, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type objType, bool runInTransaction = true).
I checked the other methods taking a Type object and they all seem to be correct.
I can prepare a PR if that helps fixing the wrong attribute on InsertAllAsync().
I'm trying to compile and publish my .NET MAUI app using Native AOT and trying to fix AOT warnings. Instead of calling
I'm calling
public Task<int> UpdateAsync(object obj, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type objType)and due to DynamicallyAccessedMembers the linker preserves by type I pass to the call. That works out OK and no trimmer warning is produced.
Now I try to do the same for InsertAllAsync():
The replacement would be
Unfortunately, it is also marked with
[RequiresUnreferencedCode]. I think theTypeparameter should be marked with[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]instead, like in theUpdateAsync()method:public Task<int> InsertAllAsync(IEnumerable objects, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type objType, bool runInTransaction = true).I checked the other methods taking a Type object and they all seem to be correct.
I can prepare a PR if that helps fixing the wrong attribute on
InsertAllAsync().