You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Discrepancy between DirectoryInfo(Base).Exists in real file system and MockFileSystem DirectoryInfoBase.Exists #661
Describe the bug
System.IO.DirectoryInfo.Exists seems to store the "exists" information at the time of creation. MockFileSystem seems to use up-to-date information.
To Reproduce
Steps to reproduce the behavior:
public void MockFileSystemDirectoryInfoExists_AfterCreate_ShouldBeFileSystemDirectoryInfoExists()
{
var folder = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
var di = new DirectoryInfo(folder);
Debug.Assert(!di.Exists, "!di.Exists");
di.Create();
var mfs = new MockFileSystem();
var di_mfs = mfs.DirectoryInfo.FromDirectoryName(folder);
Debug.Assert(!di_mfs.Exists, "!di_mfs.Exists");
di_mfs.Create();
di_mfs.Exists.Should().Be(di.Exists);
}
Expected behavior
Mock File System should behave like the real file system.
Issue-Label Bot is automatically applying the label type: bug to this issue, with a confidence of 0.93. Please mark this comment with 👍 or 👎 to give our bot feedback!
Activity
issue-label-bot commentedon Oct 27, 2020
Issue-Label Bot is automatically applying the label
type: bugto this issue, with a confidence of 0.93. Please mark this comment with 👍 or 👎 to give our bot feedback!Links: app homepage, dashboard and code for this bot.
m-ringler commentedon Oct 27, 2020
See also: https://docs.microsoft.com/en-us/dotnet/api/system.io.filesysteminfo.refresh?view=netframework-4.6.2
fgreinacher commentedon Oct 27, 2020
Interesting, thanks for reporting!
fix: make Mock{File,Directory}Info cache file attributes
fix: make Mock{File,Directory}Info cache file attributes (#791)
github-actions commentedon Jan 9, 2022
This is addressed in release v16.0.8.