Skip to content

Error when opening ImageGlass from Windows Search results (search-ms: URI treated as invalid path) #2189

@DankMemeGuy

Description

@DankMemeGuy

Windows OS version

Windows 10 22H2 (10.0.19045.0) 64-bit

ImageGlass version

v9.3.2.520

ImageGlass release

Classic

1️⃣ Steps to reproduce

  1. Open File Explorer.
  2. Use the search to narrow the folder to search for pictures in a folder. (e,g, Search > kind > photo)
  3. In the search results view, right-click an image and select Open with > ImageGlass.
  4. ImageGlass launches/crashes and immediately shows an error dialog.

2️⃣ Actual behavior

ImageGlass throws an exception:

The filename, directory name, or volume label syntax is incorrect.
'C:\Windows\search-ms:displayname=Search Results in Users&crumb=kind:=picture&crumb=location:K:\Archive\Websites\Instagram\Users'

Stack trace points to FileFinder.StartFindingFiles_WithShell in ImageGlass.Base.

It appears ImageGlass is treating the search-ms: virtual folder URI as if it were a real filesystem path.

3️⃣ Expected behavior

ImageGlass should open the selected image directly from the search results.

If a search-ms: path is encountered, ImageGlass should either:

resolve the real file path and open it, or

display a clear message that Windows Search virtual folders are not supported.

4️⃣ Screenshots / Video / Sample image file

Image
Version: ImageGlass v9.3.2.520
Release code: 1️⃣5️⃣🎂
Magick.NET: Magick.NET Q16-HDRI-OpenMP x64 net8.0 14.6.0
WebView2 Runtime: 139.0.3405.86
OS: Microsoft Windows NT 10.0.19045.0 64-bit

----------------------------------------------------
Error:

The filename, directory name, or volume label syntax is incorrect. : 'C:\Windows\search-ms:displayname=Search%20Results%20in%20Users&crumb=kind%3A%3Dpicture&crumb=location:K%3A%5CArchive%5CWebsites%5CInstagram%5CUsers'.
----------------------------------------------------

System.IO.IOException: The filename, directory name, or volume label syntax is incorrect. : 'C:\Windows\search-ms:displayname=Search%20Results%20in%20Users&crumb=kind%3A%3Dpicture&crumb=location:K%3A%5CArchive%5CWebsites%5CInstagram%5CUsers'.
   at System.IO.Enumeration.FileSystemEnumerator`1.CreateDirectoryHandle(String path, Boolean ignoreNotFound)
   at System.IO.Enumeration.FileSystemEnumerator`1.Init()
   at System.IO.Enumeration.FileSystemEnumerable`1..ctor(String directory, FindTransform transform, EnumerationOptions options, Boolean isNormalized)
   at System.IO.Enumeration.FileSystemEnumerableFactory.UserDirectories(String directory, String expression, EnumerationOptions options)
   at System.IO.Directory.InternalEnumeratePaths(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options)
   at ImageGlass.Base.FileSystem.FileFinder.StartFindingFiles_WithShell(ExplorerFolderView fv, String rootDir, Boolean searchSubDirectories, Boolean includeHidden, Predicate`1 filterFn, Func`2 nonShellSortFn) in D:\_GITHUB\@d2phap\ImageGlass\Source\Components\ImageGlass.Base\FileSystem\FileFinder.cs:line 222
   at ImageGlass.Base.FileSystem.FileFinder.StartFindingFiles(ExplorerView foregroundShell, Boolean searchSubDirectories, Boolean includeHidden, Predicate`1 filterFn, Func`2 nonShellSortFn) in D:\_GITHUB\@d2phap\ImageGlass\Source\Components\ImageGlass.Base\FileSystem\FileFinder.cs:line 141
   at ImageGlass.Base.FileSystem.FileFinder.StartFindingFiles(ExplorerView foregroundShell, IEnumerable`1 dirs, Boolean searchSubDirectories, Boolean includeHidden, Predicate`1 filterFn, Func`2 nonShellSortFn) in D:\_GITHUB\@d2phap\ImageGlass\Source\Components\ImageGlass.Base\FileSystem\FileFinder.cs:line 68
   at ImageGlass.FrmMain.LoadImageList(IEnumerable`1 inputPaths, String currentFilePath) in D:\_GITHUB\@d2phap\ImageGlass\Source\ImageGlass\FrmMain.cs:line 535
   at ImageGlass.FrmMain.PrepareLoading(String inputPath, Boolean disposeForegroundShell) in D:\_GITHUB\@d2phap\ImageGlass\Source\ImageGlass\FrmMain.cs:line 407
   at ImageGlass.FrmMain.LoadImagesFromCmdArgs(String[] args) in D:\_GITHUB\@d2phap\ImageGlass\Source\ImageGlass\FrmMain.cs:line 375
   at ImageGlass.FrmMain.FrmMain_Load(Object sender, EventArgs e) in D:\_GITHUB\@d2phap\ImageGlass\Source\ImageGlass\FrmMain\FrmMain.Configs.cs:line 306
   at System.Windows.Forms.Form.OnLoad(EventArgs e)
   at System.Windows.Forms.Control.CreateControl(Boolean ignoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at ImageGlass.UI.ModernForm.WndProc(Message& m) in D:\_GITHUB\@d2phap\ImageGlass\Source\Components\ImageGlass.UI\Forms\ModernForm.cs:line 229
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(HWND hWnd, MessageId msg, WPARAM wparam, LPARAM lparam)

5️⃣ Additional context

This happens on every folder, The photos used to work fine. This is definitely a bug with ImageGlass

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions