From bbbd592e8839dd86c23fe50adcde8531b4f023e8 Mon Sep 17 00:00:00 2001 From: Michael Fink Date: Wed, 22 Oct 2025 20:23:07 +0200 Subject: [PATCH] fixed trimmer warnings on InsertAllAsync() by using [DynamicallyAccessedMembers] for the Type parameter instead of marking the method with [RequiresUnreferencedCode] --- src/SQLiteAsync.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/SQLiteAsync.cs b/src/SQLiteAsync.cs index 85a0b00e..73d0ba41 100644 --- a/src/SQLiteAsync.cs +++ b/src/SQLiteAsync.cs @@ -227,10 +227,13 @@ Task GetMappingAsync< [RequiresUnreferencedCode ("This method requires ''DynamicallyAccessedMemberTypes.All' on the runtime type of all objects in 'objects'.")] #endif Task InsertAllAsync (IEnumerable objects, string extra, bool runInTransaction = true); + + Task InsertAllAsync (IEnumerable objects, #if NET8_0_OR_GREATER - [RequiresUnreferencedCode ("This method requires ''DynamicallyAccessedMemberTypes.All' on the runtime type of all objects in 'objects'.")] + [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.All)] #endif - Task InsertAllAsync (IEnumerable objects, Type objType, bool runInTransaction = true); + Type objType, + bool runInTransaction = true); #if NET8_0_OR_GREATER [RequiresUnreferencedCode ("This method requires ''DynamicallyAccessedMemberTypes.All' on the runtime type of 'obj'.")] #endif @@ -1424,10 +1427,13 @@ public Task InsertAllAsync (IEnumerable objects, string extra, bool runInTr /// /// The number of rows added to the table. /// + public Task InsertAllAsync ( + IEnumerable objects, #if NET8_0_OR_GREATER - [RequiresUnreferencedCode ("This method requires ''DynamicallyAccessedMemberTypes.All' on the runtime type of all objects in 'objects'.")] + [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.All)] #endif - public Task InsertAllAsync (IEnumerable objects, Type objType, bool runInTransaction = true) + Type objType, + bool runInTransaction = true) { return WriteAsync (conn => conn.InsertAll (objects, objType, runInTransaction)); }