Skip to content

NullReferenceException when instantiating MockFileSystem in Mono/Mac #82

@sisve

Description

@sisve

Environment

  • Xamarin Studio 4.3.4
  • Mono 3.4.0

Reproduction

new MockFileSystem()

Stacktrace

System.IO.Abstractions.TestingHelpers.MockPath.GetFullPath (path="C:\\Foo\\Bar")
System.IO.Abstractions.TestingHelpers.MockFileSystem.FixPath (path="C:\\Foo\\Bar")
System.IO.Abstractions.TestingHelpers.MockFileSystem..ctor (files=(null), currentDirectory="C:\\Foo\\Bar")
System.IO.Abstractions.TestingHelpers.MockFileSystem..ctor ()

Debugging shows that the MockFileSystem constructor calls FixPath which in turns calls this.pathField.GetFullPath (implemented by MockPath.GetFullPath). There's a call to this.mockFileDataAccessor.Directory.GetCurrentDirectory in GetFullPath which fails since MockFileSystem.Directory is null at this point.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions