From 87296712b33c067999f5d1493dd1757921d63944 Mon Sep 17 00:00:00 2001 From: Chris Pulman Date: Sun, 19 Nov 2023 03:51:16 +0000 Subject: [PATCH] Further code warning fixes --- .../apple-common/MacFilesystemProvider.cs | 14 ++------------ src/Akavache.Sqlite3/AsyncLock.cs | 4 ++++ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/Akavache.Core/Platforms/apple-common/MacFilesystemProvider.cs b/src/Akavache.Core/Platforms/apple-common/MacFilesystemProvider.cs index 93e8ae7d..361a57fb 100644 --- a/src/Akavache.Core/Platforms/apple-common/MacFilesystemProvider.cs +++ b/src/Akavache.Core/Platforms/apple-common/MacFilesystemProvider.cs @@ -40,18 +40,8 @@ public class MacFilesystemProvider : IFilesystemProvider private string CreateAppDirectory(NSSearchPathDirectory targetDir, string subDir = "BlobCache") { using var fm = new NSFileManager(); - var url = fm.GetUrl(targetDir, NSSearchPathDomain.All, null, true, out _); - if (url == null) - { - throw new DirectoryNotFoundException(); - } - - var rp = url.RelativePath; - if (rp == null) - { - throw new DirectoryNotFoundException(); - } - + var url = fm.GetUrl(targetDir, NSSearchPathDomain.All, null, true, out _) ?? throw new DirectoryNotFoundException(); + var rp = url.RelativePath ?? throw new DirectoryNotFoundException(); var ret = Path.Combine(rp, BlobCache.ApplicationName, subDir); if (!Directory.Exists(ret)) { diff --git a/src/Akavache.Sqlite3/AsyncLock.cs b/src/Akavache.Sqlite3/AsyncLock.cs index 8e72ef6a..d7f21d82 100644 --- a/src/Akavache.Sqlite3/AsyncLock.cs +++ b/src/Akavache.Sqlite3/AsyncLock.cs @@ -27,7 +27,11 @@ public sealed class AsyncLock : IDisposable /// /// A cancellation token which allows for release of the lock. /// A disposable which when Disposed will release the lock. +#if NETSTANDARD2_0 || XAMARINIOS || XAMARINMAC || XAMARINTVOS || MONOANDROID13_0 public Task LockAsync(CancellationToken cancellationToken = default) +#else + public Task LockAsync(in CancellationToken cancellationToken = default) +#endif { var wait = _semaphore.WaitAsync(cancellationToken);