Skip to content

FileSystemWatcher creation fails if the LogFilesPath folder isn't accessible #11

@dariokavalkeviski

Description

@dariokavalkeviski

Steps to reproduce the bug:

Error details:
System.Windows.Markup.XamlParseException: The invocation of the constructor on type 'SimFlightPath.ViewModel.MainViewModel' that matches the specified binding constraints threw an exception.
---> System.ArgumentException: The directory name 'C:\Users\Dario\AppData\Local\SimFlightPath\Flights' does not exist. (Parameter 'path')
at System.IO.FileSystemWatcher.CheckPathValidity(String path)
at System.IO.FileSystemWatcher..ctor(String path, String filter)
at SimFlightPath.Model.LogFiles.Initialize() in SimFlightPath\Model\LogFiles.cs:line 55
at SimFlightPath.Model.LogFiles..ctor() in SimFlightPath\Model\LogFiles.cs:line 49
at SimFlightPath.Model.LogFiles.get_Instance() in SimFlightPath\Model\LogFiles.cs:line 31
at SimFlightPath.ViewModel.MainViewModel..ctor() in SimFlightPath\ViewModel\MainViewModel.cs:line 98
--- End of inner exception stack trace ---
at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
at System.Windows.ResourceDictionary.CreateObject(KeyRecord key)
at System.Windows.ResourceDictionary.OnGettingValue(Object key, Object& value, Boolean& canCache)
at System.Windows.ResourceDictionary.OnGettingValuePrivate(Object key, Object& value, Boolean& canCache)
at System.Windows.ResourceDictionary.GetValueWithoutLock(Object key, Boolean& canCache)
at System.Windows.ResourceDictionary.GetValue(Object key, Boolean& canCache)
at System.Windows.ResourceDictionary.GetValueWithoutLock(Object key, Boolean& canCache)
at System.Windows.ResourceDictionary.GetValue(Object key, Boolean& canCache)
at System.Windows.Application.FindResource(Object resourceKey)
at SimFlightPath.App.OnStartup(StartupEventArgs e) in SimFlightPath\App.xaml.cs:line 77
at System.Windows.Application.<.ctor>b__1_0(Object unused)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions