Open healzy99 opened 3 months ago
加载本地目录文件异常 D:\download\upload\ System.ArgumentOutOfRangeException: 'minValue' cannot be greater than maxValue. (Parameter 'minValue') at System.Random.ThrowMinMaxValueSwapped() at System.Random.Next(Int32 minValue, Int32 maxValue) at MDriveSync.Core.ShaHashHelper.GetSamplePoints(Int64 fileLength, Int32 sampleSize, Int32 numberOfRandomSamples, Int32 seed) at MDriveSync.Core.ShaHashHelper.ComputeFileSampleHashHex(String filePath, String algorithm, Int32 seed) at MDriveSync.Core.ShaHashHelper.ComputeFileSampleHash(String filePath, String alg, Int32 seed) at MDriveSync.Core.ShaHashHelper.ComputeFileHash(String filePath, Int32 level, String alg, Int64 seed) at MDriveSync.Core.AliyunJob.<>c__DisplayClass65_1.g__LoadFiles|4(String dir)
https://github.com/trueai-org/mdrive/blob/70b240b13360d6c300b4418acdaefca5a3ae30ab/src/MDriveSync.Core/Services/ShaHashHelper.cs#L54-L57
如果不满足fileLength <= sampleSize * (3 + numberOfRandomSamples) 且sampleSize 大于fileLength 时,
fileLength <= sampleSize * (3 + numberOfRandomSamples)
sampleSize
fileLength
https://github.com/trueai-org/mdrive/blob/70b240b13360d6c300b4418acdaefca5a3ae30ab/src/MDriveSync.Core/Services/ShaHashHelper.cs#L99
random.Next 可能出现minValue大于maxValue的情况, @trueai-org 大佬看看是不是需要修改一下临界条件
random.Next
加载本地目录文件异常 D:\download\upload\ System.ArgumentOutOfRangeException: 'minValue' cannot be greater than maxValue. (Parameter 'minValue') at System.Random.ThrowMinMaxValueSwapped() at System.Random.Next(Int32 minValue, Int32 maxValue) at MDriveSync.Core.ShaHashHelper.GetSamplePoints(Int64 fileLength, Int32 sampleSize, Int32 numberOfRandomSamples, Int32 seed) at MDriveSync.Core.ShaHashHelper.ComputeFileSampleHashHex(String filePath, String algorithm, Int32 seed) at MDriveSync.Core.ShaHashHelper.ComputeFileSampleHash(String filePath, String alg, Int32 seed) at MDriveSync.Core.ShaHashHelper.ComputeFileHash(String filePath, Int32 level, String alg, Int64 seed) at MDriveSync.Core.AliyunJob.<>c__DisplayClass65_1.g__LoadFiles|4(String dir)