Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After formatting , DirectoryInfo.GetFileSystemInfos throw DirectoryNotFoundException #41

Closed
alphaleonis opened this issue Jan 15, 2015 · 6 comments

Comments

@alphaleonis
Copy link
Owner

Issue by hnorihiro from Friday Jan 09, 2015 at 11:16 GMT
Originally opened as #41


1.I format the G drive

AlphaFS(2015/1/8)

DirectoryInfo info = new DirectoryInfo(@"G:\");
info.GetFileSystemInfos();//Directory not found Exception

.NET

System.IO.DirectoryInfo info = new System.IO.DirectoryInfo(@"G:\");
info.GetFileSystemInfos();//Success!!

Can you help me?

@alphaleonis alphaleonis added this to the Future milestone Jan 15, 2015
@alphaleonis
Copy link
Owner Author

Comment by Yomodo from Friday Jan 09, 2015 at 11:35 GMT


What type of device is G: (external drive, USB stick, ...)
NTFS formatting?

@alphaleonis
Copy link
Owner Author

Comment by hnorihiro from Wednesday Jan 14, 2015 at 01:03 GMT


Yes, it is NTFS(USB Drive).
Drive When it is empty after formatting, occurs error.
Drive When $RECYCLE.BIN exist,does not occurs.

@alphaleonis
Copy link
Owner Author

Comment by Yomodo from Wednesday Jan 14, 2015 at 23:24 GMT


Does it still throw the exception if you execute: info.Refresh(); first?

@alphaleonis
Copy link
Owner Author

Comment by hnorihiro from Thursday Jan 15, 2015 at 01:49 GMT


OS Windows7
.NET 3.5

DirectoryInfo info = new DirectoryInfo(@"G:\");
info.Refresh();
info.GetFileSystemInfos();//Directory not found Exception

it still throw the exception .

@alphaleonis
Copy link
Owner Author

Comment by Yomodo from Thursday Jan 15, 2015 at 10:14 GMT


Confirmed on Windows 8.1 X64

It seems related to the volume label.
The exception can be avoided with: /v:myLabel
But even then I still see the Exception thrown, sometimes.

var drive = @"D:";
var format_cmd = "/C format.com " + drive + " /fs:NTFS /v:myLabel /q";

using (var process = Process.Start("CMD.exe", format_cmd))
    process.WaitForExit();

DirectoryInfo info = new DirectoryInfo(drive + @"\");
info.GetFileSystemInfos();

However, System.IO indeed does not throw an Exception.

@alphaleonis alphaleonis modified the milestones: Version 2.0, Future, Bugfix Release 2.0.1 Jan 16, 2015
Yomodo added a commit that referenced this issue Jan 19, 2015
@Yomodo
Copy link
Collaborator

Yomodo commented Feb 1, 2015

Unfortunately, I could not find anything to fix within AlphaFS.

The only possbile fix for this issue,
is to add a: Thread.Sleep(1000); before calling DirectoryInfo().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants