title: Xamarin Forms Android can't delete image from gallery or App folders with no error displayed
body: <p>I have a Xamarin Forms Android App and I can't delete images from gallery or App folders using the App. No error displays after failure. I am targeting Android 10.0. Relevant code is below:</p>
  <p>\Interface</p>
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Text;
  
  namespace TCmTickets
  {
      public interface IDeleteFromFile
      {
          void DeleteFile(string source);
      }
  }
  </code></pre>
  <p>\Class</p>
  <pre><code>using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  
  using Android.App;
  using Android.Content;
  using Android.OS;
  using Android.Runtime;
  using Android.Views;
  using Android.Widget;
  using System.IO;
  using Xamarin.Forms;
  
  [assembly: Dependency(typeof(TCmTickets.Droid.DeleFromFile))]
  namespace TCmTickets.Droid
  {
  
      class DeleFromFile : IDeleteFromFile
      {
          public void DeleteFile(string source)
          {
              File.Delete(source);
          }
      }
  }
  </code></pre>
  <p>\MainActivity</p>
  <pre><code>    DependencyService.Register &lt;DeleFromFile&gt;();
  
      DependencyService.Get&lt;DeleFromFile&gt;();
  </code></pre>
  <p>\Function</p>
  <pre><code>private async void DeleteFileTest()
  {
      var file = await Plugin.Media.CrossMedia.Current.PickPhotoAsync(new Plugin.Media.Abstractions.PickMediaOptions
      {
          PhotoSize = Plugin.Media.Abstractions.PhotoSize.Medium,
      });
  
  
      if (file != null)
      {
          if (File.Exists(file.Path))
          {
              DependencyService.Get&lt;IDeleteFromFile&gt;().DeleteFile(file.Path);
          }
          file.Dispose();
      }
  }
  
  
  void btnDeleteFile_Clicked(object sender, EventArgs e)
  {
      DeleteFileTest();
  }
  </code></pre>
  <p>Could this have something to do with Android 10. I am using the correct permissions - I have included the following in Android Manifest</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot; android:versionCode=&quot;1&quot; android:versionName=&quot;1.0&quot; package=&quot;com.companyname.TCmTickets&quot; android:installLocation=&quot;preferExternal&quot;&gt;
      &lt;uses-sdk android:minSdkVersion=&quot;25&quot; android:targetSdkVersion=&quot;29&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.ACCESS_COARSE_LOCATION&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.ACCESS_FINE_LOCATION&quot; /&gt;
      &lt;uses-feature android:name=&quot;android.hardware.location&quot; android:required=&quot;false&quot; /&gt;
      &lt;uses-feature android:name=&quot;android.hardware.location.gps&quot; android:required=&quot;false&quot; /&gt;
      &lt;uses-feature android:name=&quot;android.hardware.location.network&quot; android:required=&quot;false&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.ACCESS_NETWORK_STATE&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.ACCESS_WIFI_STATE&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.CAMERA&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.ACCESS_LOCATION_EXTRA_COMMANDS&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.WRITE_EXTERNAL_STORAGE&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.READ_EXTERNAL_STORAGE&quot; /&gt;
      &lt;application android:label=&quot;TCmTickets.Android&quot; android:requestLegacyExternalStorage=&quot;true&quot;&gt;
          &lt;provider android:name=&quot;android.support.v4.content.FileProvider&quot; android:authorities=&quot;${applicationId}.fileprovider&quot; android:exported=&quot;false&quot; android:grantUriPermissions=&quot;true&quot;&gt;
              &lt;meta-data android:name=&quot;android.support.FILE_PROVIDER_PATHS&quot; android:resource=&quot;@xml/file_paths&quot;&gt;&lt;/meta-data&gt;
          &lt;/provider&gt;
          &lt;meta-data android:name=&quot;com.google.android.maps.v2.API_KEY&quot; android:value=&quot;xxxx&quot; /&gt;
          &lt;meta-data android:name=&quot;com.google.android.gms.version&quot; android:value=&quot;@integer/google_play_services_version&quot; /&gt;
          &lt;uses-library android:name=&quot;org.apache.http.legacy&quot; android:required=&quot;false&quot; /&gt;
      &lt;/application&gt;
  &lt;/manifest&gt;
  </code></pre>