0
私はWPFビューモデルのコマンドの1つからダイアログを表示しようとしていますが、ShowDialog()
がSystem.ArgumentException
をスローすると、なぜ誰かが私にヒントを与えることができるのだろうかと疑問に思っていましたか?要求されたようOpenFileDialog.ShowDialog()は例外をスローしますか?
Public ReadOnly Property OpenParser As ICommand
Get
Return New RelayCommand(Sub(param As Object) OpenParserExecute(DirectCast(param, Frame)))
End Get
End Property
Public Sub OpenParserExecute(ByVal mFrame As Frame)
SaveParserExecute()
Dim mOpenDialog As OpenFileDialog = OpenDialog
If mOpenDialog.ShowDialog() Then ' Lines the throws the exception
CurrentParser = New ParserEditorModel(mOpenDialog.FileName)
mFrame.Navigate(New ParserEditor(CurrentParser))
End If
End Sub
のStackTrace::自身がNullable(Of Boolean)
とあなたのIf
文がnull非許容Boolean
期待しているが返されます
at MS.Internal.Interop.HRESULT.ThrowIfFailed(String message)
at MS.Internal.AppModel.ShellUtil.GetShellItemForPath(String path)
at Microsoft.Win32.FileDialog.PrepareVistaDialog(IFileDialog dialog)
at Microsoft.Win32.FileDialog.RunVistaDialog(IntPtr hwndOwner)
at Microsoft.Win32.FileDialog.RunDialog(IntPtr hwndOwner)
at Microsoft.Win32.CommonDialog.ShowDialog()
at WinTransform.GUI.MainWindowModel.OpenParserExecute(Frame mFrame) in C:\Users\Alex\Desktop\MEDLI\branches\WinTransform\GUI\ViewModels\MainWindowModel.vb:line 38
OpenDialogオブジェクトに問題があります。あなたが例外のStackTraceを投稿しない限り、それが何であるかを推測するのは難しいです。 –
スタックトレースを追加しました。 –
OpenDialog.InitialDirectoryプロパティに問題があります。 –