daniel-lerch / vocup

Vocabulary trainer.
https://www.microsoft.com/store/apps/9N6W2H3QJQMM
GNU Affero General Public License v3.0
9 stars 3 forks source link

Crash when default folder is read only #37

Closed megabugman closed 3 years ago

megabugman commented 3 years ago
  1. click magnifying glass icon
  2. in Browse For Folder dialog select the DVD Drive
  3. Click OK -> Crash

Solution: disable OK

See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box.

** Exception Text ** System.IO.IOException: The device is not ready.

at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileSystemEnumerableIterator`1.CommonInit() at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost) at System.IO.DirectoryInfo.InternalGetDirectories(String searchPattern, SearchOption searchOption) at Vocup.Controls.FileTreeView.LoadNodes(TreeNode root) in C:\Users\Daniel Lerch\source\vocup\src\Vocup\Controls\FileTreeView.cs:line 140 at Vocup.Controls.FileTreeView.set_RootPath(String value) in C:\Users\Daniel Lerch\source\vocup\src\Vocup\Controls\FileTreeView.cs:line 68 at Vocup.MainForm.FileTreeView_BrowseClick(Object sender, EventArgs e) in C:\Users\Daniel Lerch\source\vocup\src\Vocup\MainForm.cs:line 262 at Vocup.Controls.FileTreeView.OnBrowseClick(EventArgs e) in C:\Users\Daniel Lerch\source\vocup\src\Vocup\Controls\FileTreeView.cs:line 118 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

daniel-lerch commented 3 years ago

Handling all possible IO errors is very difficult. Here are some cases that I thought about

Check read permissions for VhfPath on

Catch IOException for file read on

Exceptions are already caught for file writes.