Summary
Loading a project whose directory no longer exists — e.g. a stale recent-projects entry pointing at a moved or deleted path — crashes OneWare Studio. NetlistGenerator.SetupWatchers() constructs a FileSystemWatcher on the project's FullPath without checking that the directory exists. The constructor throws ArgumentException, and because SetupWatchers runs from the ProjectExplorer Projects collection-changed handler, the exception is unhandled and takes down the whole application.
Environment
- OneWare Studio 1.0.21 (macOS, arm64)
- FEntwumS.NetlistViewer @ current
master
Steps to reproduce
- Have a recent-projects entry whose directory no longer exists (or open a project, then move/delete its directory).
- Launch OneWare / open the project.
- The IDE crashes.
Stack trace (key frames)
System.ArgumentException: The directory name '<project directory>' does not exist. (Parameter 'path')
at System.IO.FileSystemWatcher.CheckPathValidity(String path)
at System.IO.FileSystemWatcher..ctor(String path)
at FEntwumS.NetlistViewer.Services.NetlistGenerator.SetupWatchers() in src/FEntwumS.NetlistViewer/Services/NetlistGenerator.cs:line 240
at FEntwumS.NetlistViewer.Services.NetlistGenerator.<.ctor>b__11_0(object sender, NotifyCollectionChangedEventArgs args) in src/FEntwumS.NetlistViewer/Services/NetlistGenerator.cs:line 41
at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
at OneWare.ProjectExplorer.ViewModels.ProjectExplorerViewModel.AddProject(IProjectRoot project)
Suggested fix
Guard the watcher creation with Directory.Exists and skip a project whose directory is absent, so a stale or removed path degrades gracefully instead of crashing:
if (p is UniversalProjectRoot root)
{
if (!Directory.Exists(root.FullPath))
{
_logger.Warning($"Skipping netlist watcher for missing project directory: {root.FullPath}");
continue;
}
FileSystemWatcher watcher = new FileSystemWatcher(root.FullPath)
{ /* ... */ };
}
Verified locally: with the guard, the missing-directory case logs a single skip-warning and the IDE stays up. Happy to open a PR from a fork if that's welcome.
Summary
Loading a project whose directory no longer exists — e.g. a stale recent-projects entry pointing at a moved or deleted path — crashes OneWare Studio.
NetlistGenerator.SetupWatchers()constructs aFileSystemWatcheron the project'sFullPathwithout checking that the directory exists. The constructor throwsArgumentException, and becauseSetupWatchersruns from the ProjectExplorerProjectscollection-changed handler, the exception is unhandled and takes down the whole application.Environment
masterSteps to reproduce
Stack trace (key frames)
Suggested fix
Guard the watcher creation with
Directory.Existsand skip a project whose directory is absent, so a stale or removed path degrades gracefully instead of crashing:Verified locally: with the guard, the missing-directory case logs a single skip-warning and the IDE stays up. Happy to open a PR from a fork if that's welcome.