From 93846252415ce2dd8144727d61847d58a54fc42c Mon Sep 17 00:00:00 2001 From: Bhavanesh N Date: Thu, 13 Feb 2025 11:52:32 +0530 Subject: [PATCH] [Android] Fix Cursor Not Closing in File Picker to Prevent Log Spam. (#27718) * explicitly close the cursor * changing to not null Co-authored-by: MartyIX <203266+MartyIX@users.noreply.github.com> --------- Co-authored-by: MartyIX <203266+MartyIX@users.noreply.github.com> --- src/Essentials/src/FileSystem/FileSystemUtils.android.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Essentials/src/FileSystem/FileSystemUtils.android.cs b/src/Essentials/src/FileSystem/FileSystemUtils.android.cs index 16c1dfdb70d4..ce693826e009 100644 --- a/src/Essentials/src/FileSystem/FileSystemUtils.android.cs +++ b/src/Essentials/src/FileSystem/FileSystemUtils.android.cs @@ -345,6 +345,9 @@ static string QueryContentResolverColumn(AndroidUri contentUri, string columnNam text = cursor.GetString(columnIndex); } + if (cursor is not null && !cursor.IsClosed) + cursor.Close(); + return text; }