Skip to content

File.Create throws exception for relative file paths #401

@Gav-Brown

Description

@Gav-Brown

Package Version

2.1.0.256

Repro steps

  1. Create MockFileSystem
  2. Create working directory
  3. Set working directory
  4. Call

using (var file = fileSystem.File.Create("File.txt")) { }

Expected behavior

File is created in current working directory (which does exist).

Actual behavior

Exception is thrown.
Could not find a part of the path 'File.txt'.

This worked in version 2.0.0.144. I suspect it is due to change for #278 an #286
which assumes an absolute file path rather than a relative one.

.NET Framework version handles both cases, as does

fileSystem.File.WriteAllText("File.txt", null);

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