Skip to content

Commit

Permalink
Merge branch 'fix/filesystem-hides-error' into release/2.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
gigajuwels committed Oct 4, 2023
2 parents d26757f + bc8c1f1 commit a60ee65
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions Core Modules/WalletConnectSharp.Storage/FileSystemStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,23 +110,8 @@ private async Task Load()
await _semaphoreSlim.WaitAsync();
var json = await File.ReadAllTextAsync(FilePath, Encoding.UTF8);
_semaphoreSlim.Release();

try
{
Entries = JsonConvert.DeserializeObject<Dictionary<string, object>>(json,
new JsonSerializerSettings() {TypeNameHandling = TypeNameHandling.Auto});
}
catch (JsonSerializationException e)
{
// Move the file to a .unsupported file
// and start fresh
WCLogger.LogError(e);
WCLogger.LogError("Cannot load JSON file, moving data to .unsupported file to force continue");
if (File.Exists(FilePath + ".unsupported"))
File.Move(FilePath + ".unsupported", FilePath + "." + Guid.NewGuid() + ".unsupported");
File.Move(FilePath, FilePath + ".unsupported");
Entries = new Dictionary<string, object>();
}
Entries = JsonConvert.DeserializeObject<Dictionary<string, object>>(json,
new JsonSerializerSettings() { TypeNameHandling = TypeNameHandling.Auto });
}
}
}

0 comments on commit a60ee65

Please sign in to comment.