Restore DB: Clear the Restore As filename box, get exception

If you clear the filename of a database to restore and leave the field, an exception is raised instead of being handled gracefully with a message like: "Filename Required".

Steps to reproduce:

  • Choose the restore database option.
  • Set From Database to false
  • Pick a .bak file
  • To Database: Give it some name
  • Put a checkbox beside the DB in the file to restore
  • Click on the Options tab
  • In the .mdf file restore as box, clear the path (i.e. because you want to type a different filename / path since the filename it puts here is the one from the server where the file was mounted originally and does not exist on this different machine)

If you leave the field blank prior to clicking the builder button to browse to a new path, or if you just leave the field, you get exception:

System.ArgumentException
The path is not of a legal form.
Stack Trace:
at System.IO.Path.NormalizePathFast(String path, Boolean fullCheck)
at System.IO.Path.NormalizePath(String path, Boolean fullCheck)
at System.IO.Path.GetDirectoryName(String path)
at Quest.Toad.SqlServer.Doe.RestoreDatabase.RestoreDatabaseOptionsEditControl.updateRowValues(Int32 changedRowHandle)
at Quest.Toad.SqlServer.Doe.RestoreDatabase.RestoreDatabaseOptionsEditControl._gridInfoFileRestoreColumns_FocusedRowChanged(Object sender, FocusedRowChangedEventArgs e)
at DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventHandler.Invoke(Object sender, FocusedRowChangedEventArgs e)
at DevExpress.XtraGrid.Views.Base.ColumnView.RaiseFocusedRowChanged(Int32 prevFocused, Int32 focusedRowHandle)
at DevExpress.XtraGrid.Views.Base.ColumnView.DoChangeFocusedRowInternal(Int32 newRowHandle, Boolean updateCurrentRow)
at DevExpress.XtraGrid.Views.Grid.GridView.DoMoveFocusedRow(Int32 delta, Keys byKey, KeyEventArgs e)
at DevExpress.XtraGrid.Views.Grid.GridView.GetNearestCanFocusedColumn(GridColumn col, Int32 delta, Boolean allowChangeFocusedRow, KeyEventArgs e)
at DevExpress.XtraGrid.Views.Grid.Handler.GridHandler.DoMoveFocusedColumn(Int32 delta, Boolean autoMoveRowFocus, KeyEventArgs e)
at DevExpress.XtraGrid.Views.Grid.Handler.GridRegularRowNavigator.DoNavigation(KeyEventArgs e)
at DevExpress.XtraGrid.Views.Grid.Handler.GridRegularRowNavigator.OnKeyDown(KeyEventArgs e)
at DevExpress.XtraGrid.Views.Grid.Handler.GridHandler.OnKeyDown(KeyEventArgs e)
at DevExpress.XtraGrid.Views.Grid.Handler.GridHandler.ProcessKey(KeyEventArgs e)
at DevExpress.Utils.Controls.BaseHandler.ProcessEvent(EventType etype, Object args)
at DevExpress.XtraGrid.Views.Base.Handler.BaseViewHandler.ProcessEvent(EventType etype, Object args)
at DevExpress.XtraGrid.GridControl.RaiseEditorKeyDown(KeyEventArgs e)
at DevExpress.XtraEditors.Container.EditorContainer.DevExpress.XtraEditors.Container.IEditorContainer.OnEditorKeyDown(KeyEventArgs e)
at DevExpress.XtraEditors.BaseEdit.OnEditorKeyDown(KeyEventArgs e)
at DevExpress.XtraEditors.TextEdit.OnEditorKeyDown(KeyEventArgs e)
at DevExpress.XtraEditors.ButtonEdit.OnEditorKeyDown(KeyEventArgs e)
at DevExpress.XtraEditors.BaseEdit.OnKeyDown(KeyEventArgs e)
at DevExpress.XtraEditors.TextEdit.OnMaskBox_KeyDown(Object sender, KeyEventArgs e)
at System.Windows.Forms.Control.OnKeyDown(KeyEventArgs e)
at DevExpress.XtraEditors.Mask.MaskBox.OnKeyDown(KeyEventArgs e)
at System.Windows.Forms.Control.ProcessKeyEventArgs(Message& m)
at DevExpress.XtraEditors.Mask.MaskBox.ProcessKeyEventArgs(Message& m)
at System.Windows.Forms.Control.ProcessKeyMessage(Message& m)
at System.Windows.Forms.Control.WmKeyChar(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.TextBoxBase.WndProc(Message& m)
at System.Windows.Forms.TextBox.WndProc(Message& m)
at DevExpress.XtraEditors.Mask.MaskBox.BaseWndProc(Message& m)
at DevExpress.XtraEditors.Mask.MaskBox.MaskStrategy.SimpleStrategy.DoWndProc(Message& m)
at DevExpress.XtraEditors.Mask.MaskBox.WndProc(Message& m)
at DevExpress.XtraEditors.TextBoxMaskBox.WndProc(Message& msg)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

And below that exception you have another version of the same exception:

System.ArgumentException
The path is not of a legal form.
Stack Trace:
at System.IO.Path.NormalizePathFast(String path, Boolean fullCheck)
at System.IO.Path.NormalizePath(String path, Boolean fullCheck)
at System.IO.Path.GetDirectoryName(String path)
at Quest.Toad.SqlServer.Doe.RestoreDatabase.RestoreDatabaseOptionsEditControl.updateRowValues(Int32 changedRowHandle)
at Quest.Toad.SqlServer.Doe.RestoreDatabase.RestoreDatabaseOptionsEditControl.restore_Leave(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnLeave(EventArgs e)
at DevExpress.XtraEditors.BaseEdit.OnLeave(EventArgs e)
at System.Windows.Forms.Control.NotifyLeave()
at System.Windows.Forms.ContainerControl.UpdateFocusedControl()

Darren

ToadException.jpeg

Hi Darren,
thanks for the reporting! CR78847 was created.