System.IO.Abstractions: Bug introduced in 2.1.0.174 with enumerating files

In a couple of unit tests for one of my projects, I create a MockFileSystem and .AddDirectory("/dev/bus/usb"); I then add files under this directory such as /dev/bus/usb/1/2.

As part of these tests, my SUT will later execute the following method:

private void PopulateConnectedDevices()
{
    _logger.LogDebug("Populating connected USB devices under {DevDirectorPath}", _watcher.Path);
    _connectedDevices.Clear();

    foreach (var path in _fileSystem.Directory.EnumerateFiles(_watcher.Path, "*", SearchOption.AllDirectories))
    {
        var deviceFile = _fileSystem.FileInfo.FromFileName(path);

        if (!_deviceFileParser.TryParseAsDeviceInterface(deviceFile, out var vendorId, out var productId))
        {
            continue;
        }

        _logger.LogTrace("Discovered USB device (VID: {VendorId}, PID: {ProductId})", vendorId, productId);
        AddConnectedDevice(GetCanonicalPath(path), vendorId, productId);
    }
}

Up until System.IO.Abstractions 2.1.0.173, these unit tests passed. With System.IO.Abstractions 2.1.0.174+, it fails to enumerate any files even though they’re there.

Looking at the AppVeyor build history, it seems that the bug was introduced from #258.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (2 by maintainers)

Most upvoted comments

Awesome. Thanks for the update. If it pops up again please don’t hesitate to reach out.