Skip to content

MockDirectory.GetParent() throws NullReference on Linux #395

@peter-sereda

Description

@peter-sereda

Please consider the following code:
var fileSystem = new MockFileSystem(); var path = XFS.Path("C:\\test.txt"); DirectoryInfoBase dir = fileSystem.Directory.GetParent(path);

It works ok on Windows but throws NullReferenceException on Linux. I believe this is a bug.

As a workaround, one may add an intermediate folder to the path. fileSystem.Directory.GetParent("c:\\temp\\test.txt"); gonna work ok.

Metadata

Metadata

Assignees

No one assigned

    Labels

    state: in workIssues that are currently worked ontype: bugIssues that describe misbehaving functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions