>>>As the handle is marked as Invalid, I *think* we can rely on a using statement to shut of the warnings about not disposing an `IDisposable` resource. AFAIR, the handle doesn't get freed when marked Invalid.

>>But we get some messages shown that an invalid handle is being disposed.

>Duh. Let's go with a `try { ... } finally { handle.SafeDispose() }` construct then.

>I've logged #735 to (try to) clean this up later.

OK. While working on #735, I got confirmation that my previous hunch was actually working. When the handle is marked as invalid, it can safely be disposed, the pointer won't get freed as `ReleaseHandle()` won't be called.

Could you please give a try to the following patch? It makes the code a bit easier to read.

```diff
diff --git a/LibGit2Sharp/Core/Proxy.cs b/LibGit2Sharp/Core/Proxy.cs
index c7650b0..167645b 100644
--- a/LibGit2Sharp/Core/Proxy.cs
+++ b/LibGit2Sharp/Core/Proxy.cs
@@ -1787,28 +1787,21 @@ public static void git_remote_connect(RemoteSafeHandle remote, GitDirection dire
 
         public static void git_remote_delete(RepositorySafeHandle repo, string name)
         {
             using (ThreadAffinity())
             {
-                RemoteSafeHandle remote = null;
-
-                try
+                using (RemoteSafeHandle remote = git_remote_load(repo, name, false))
                 {
-                    remote = Proxy.git_remote_load(repo, name, false);
                     if (remote == null)
                     {
                         return;
                     }
 
                     int res = NativeMethods.git_remote_delete(remote);
                     Ensure.ZeroResult(res);
                     remote.SetHandleAsInvalid();
                 }
-                finally
-                {
-                    remote.SafeDispose();
-                }
             }
         }
 
         public static void git_remote_disconnect(RemoteSafeHandle remote)
         {
```