Skip to content

Commit

Permalink
Revert "Merge branch 'fix/filesystem-hides-error' into release/2.1.1"
Browse files Browse the repository at this point in the history
This reverts commit a60ee65, reversing
changes made to d26757f.
  • Loading branch information
skibitsky committed Oct 16, 2023
1 parent e14928f commit 25aa38a
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions Core Modules/WalletConnectSharp.Storage/FileSystemStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,23 @@ private async Task Load()
await _semaphoreSlim.WaitAsync();
var json = await File.ReadAllTextAsync(FilePath, Encoding.UTF8);
_semaphoreSlim.Release();
Entries = JsonConvert.DeserializeObject<Dictionary<string, object>>(json,
new JsonSerializerSettings() { TypeNameHandling = TypeNameHandling.Auto });

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>();
}
}
}
}

0 comments on commit 25aa38a

Please sign in to comment.