From 0f40439f2e39df9943c2605c114bac28cf15a309 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Tue, 16 Apr 2024 20:28:39 +0100 Subject: [PATCH] fix: fix error resulting from concurrent access of hash map --- FindDuplicates/FindDuplicates.csproj | 2 +- FindDuplicates/ListCommand.cs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/FindDuplicates/FindDuplicates.csproj b/FindDuplicates/FindDuplicates.csproj index ee11460..8be28bf 100644 --- a/FindDuplicates/FindDuplicates.csproj +++ b/FindDuplicates/FindDuplicates.csproj @@ -6,7 +6,7 @@ enable enable fdup - 1.0.0 + 1.0.1 Oliver Booth diff --git a/FindDuplicates/ListCommand.cs b/FindDuplicates/ListCommand.cs index 01f1f38..f697925 100644 --- a/FindDuplicates/ListCommand.cs +++ b/FindDuplicates/ListCommand.cs @@ -1,4 +1,5 @@ -using System.Diagnostics; +using System.Collections.Concurrent; +using System.Diagnostics; using System.Security.Cryptography; using System.Text; using Spectre.Console; @@ -8,7 +9,7 @@ namespace FindDuplicates; internal sealed class ListCommand : AsyncCommand { - private readonly Dictionary> _fileHashMap = new(); + private readonly ConcurrentDictionary> _fileHashMap = new(); public override async Task ExecuteAsync(CommandContext context, ListSettings settings) {