fix: fix error resulting from concurrent access of hash map

This commit is contained in:
Oliver Booth 2024-04-16 20:28:39 +01:00
parent 64c23c888d
commit 0f40439f2e
Signed by: oliverbooth
GPG Key ID: E60B570D1B7557B5
2 changed files with 4 additions and 3 deletions

View File

@ -6,7 +6,7 @@
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<AssemblyName>fdup</AssemblyName> <AssemblyName>fdup</AssemblyName>
<VersionPrefix>1.0.0</VersionPrefix> <VersionPrefix>1.0.1</VersionPrefix>
<Authors>Oliver Booth</Authors> <Authors>Oliver Booth</Authors>
</PropertyGroup> </PropertyGroup>

View File

@ -1,4 +1,5 @@
using System.Diagnostics; using System.Collections.Concurrent;
using System.Diagnostics;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Text; using System.Text;
using Spectre.Console; using Spectre.Console;
@ -8,7 +9,7 @@ namespace FindDuplicates;
internal sealed class ListCommand : AsyncCommand<ListSettings> internal sealed class ListCommand : AsyncCommand<ListSettings>
{ {
private readonly Dictionary<string, List<FileInfo>> _fileHashMap = new(); private readonly ConcurrentDictionary<string, List<FileInfo>> _fileHashMap = new();
public override async Task<int> ExecuteAsync(CommandContext context, ListSettings settings) public override async Task<int> ExecuteAsync(CommandContext context, ListSettings settings)
{ {