MatchingFileFinder.SubStringEquals sliced a fixed number of characters off each enumerated file name without checking the name was long enough:
var slice = value.Slice(start, match.Length);
The Win32 search pattern used to enumerate candidates is {prefix}*.received.* / {prefix}*.verified.*, and a trailing .* also matches a name with no extension. So a stray file named exactly {prefix}.received or {prefix}.verified is returned by the enumeration, but is one character shorter than the {prefix}.received. pattern it is compared against, and the slice throws.
Symptom
With a file such as MyTests.MyTest.verified (extension dropped by an editor, a git operation, or a manual rename) sitting beside the snapshots, every subsequent run of MyTests.MyTest throws:
System.ArgumentOutOfRangeException: Index and length must refer to a location within the string.
from MatchingFileFinder.FindVerified / DeleteReceived, during InnerVerifier construction — before the test body executes. The failure gives no hint that an unrelated stray file is the cause.
Fix
Length-check before slicing, so a name shorter than the pattern is simply not a match.
Fixed in a43e52e, covered by MatchingFileFinderTests.StrayFileWithNoExtensionIsIgnored.
MatchingFileFinder.SubStringEqualssliced a fixed number of characters off each enumerated file name without checking the name was long enough:The Win32 search pattern used to enumerate candidates is
{prefix}*.received.*/{prefix}*.verified.*, and a trailing.*also matches a name with no extension. So a stray file named exactly{prefix}.receivedor{prefix}.verifiedis returned by the enumeration, but is one character shorter than the{prefix}.received.pattern it is compared against, and the slice throws.Symptom
With a file such as
MyTests.MyTest.verified(extension dropped by an editor, a git operation, or a manual rename) sitting beside the snapshots, every subsequent run ofMyTests.MyTestthrows:from
MatchingFileFinder.FindVerified/DeleteReceived, duringInnerVerifierconstruction — before the test body executes. The failure gives no hint that an unrelated stray file is the cause.Fix
Length-check before slicing, so a name shorter than the pattern is simply not a match.
Fixed in a43e52e, covered by
MatchingFileFinderTests.StrayFileWithNoExtensionIsIgnored.