From 9dcc02c34163f4c274023bde6cb3ebea3fe0be2f Mon Sep 17 00:00:00 2001 From: skibitsky Date: Tue, 5 Dec 2023 16:18:30 +0900 Subject: [PATCH] Fixed: ObjectDisposedException The semaphore has been disposed --- .../WalletConnectSharp.Storage/FileSystemStorage.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Core Modules/WalletConnectSharp.Storage/FileSystemStorage.cs b/Core Modules/WalletConnectSharp.Storage/FileSystemStorage.cs index 5414eb9..9583b61 100644 --- a/Core Modules/WalletConnectSharp.Storage/FileSystemStorage.cs +++ b/Core Modules/WalletConnectSharp.Storage/FileSystemStorage.cs @@ -15,7 +15,7 @@ public class FileSystemStorage : InMemoryStorage /// public string FilePath { get; private set; } - private readonly SemaphoreSlim _semaphoreSlim = new(1); + private SemaphoreSlim _semaphoreSlim; /// /// A new FileSystemStorage module that reads/writes all storage @@ -39,9 +39,10 @@ public FileSystemStorage(string filePath = null) /// as well as loads in the JSON file /// /// - public override Task Init() + public override async Task Init() { - return Task.WhenAll( + _semaphoreSlim = new SemaphoreSlim(1, 1); + await Task.WhenAll( Load(), base.Init() ); }