Skip to content

System.ArgumentException: An item with the same key has already been added. #1798

@OleksandrNovik

Description

@OleksandrNovik

Hi!

I would like to report issue that I recently came accross working with AsyncFtpClient. Package ver: 53.0.1

DownloadDirectory method can throw ArgumentException due to usage of ToLower() on localFile path in shouldExist dictionary. I think this is because the files have different names when case-sensitive checking is enabled, but if you convert them to lowercase, they become identical.

Here is also detailed stack trace of the issue:

System.ArgumentException: An item with the same key has already been added. at System.Collections.Generic.Dictionary2.TryInsert(TKey key, TValue value, InsertionBehavior behavior) at System.Collections.Generic.Dictionary2.Add(TKey key, TValue value) at FluentFTP.Client.Modules.FileDownloadModule.RecordFileToDownload(BaseFtpClient client, List1 rules, List1 results, Dictionary2 shouldExist, List1 toDownload, FtpListItem remoteFile, String localFile, String remoteFilePath) at FluentFTP.Client.Modules.FileDownloadModule.GetFilesToDownload(BaseFtpClient client, String localFolder, String remoteFolder, List1 rules, List1 results, FtpListItem[] listing, Dictionary2 shouldExist) at FluentFTP.AsyncFtpClient.DownloadDirectory(String localFolder, String remoteFolder, FtpFolderSyncMode mode, FtpLocalExists existsMode, FtpVerify verifyOptions, List1 rules, IProgress1 progress, CancellationToken token)

I also referenced the line that may cause this issue. You can check it out here

Hope this information will be helpful.

All the best!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions