Repository navigation
Description
Description
When the built-in Image Converter tool receives a file that no longer exists, DevToys terminates immediately with an unhandled FileNotFoundException.
The exception escapes ImageConverterGuiTool.OnDataReceived, which is declared async void, so the try/catch in GuiToolInstance cannot observe it and the process is killed via Task.ThrowAsync.
Steps to reproduce
- Put a file reference somewhere that reaches the Image Converter tool (clipboard file list, "Open with DevToys", recent file, etc.).
- Delete the file before the tool consumes it.
- Start DevToys / open the Image Converter tool.
- The app exits a few seconds after startup.
In my case the tool received C:\Users\Admin\Desktop\门岗新环保新流程.png, which had already been deleted.
Expected behavior
Show an error inside the tool (or ignore the incoming data) and keep the application running.
Actual behavior
The whole app crashes. Windows Event Log shows .NET Runtime event 1026 and Application Error event 1000 (KERNELBASE.dll, exception code 0xe0434352).
Stack trace
System.IO.FileNotFoundException: Unable to find the indicated file.
File name: 'C:\Users\Admin\Desktop\门岗新环保新流程.png'
at DevToys.Api.SimpleSandboxedFileReader..ctor(FileInfo fileInfo) in ...\SimpleSandboxedFileReader.cs:line 21
at DevToys.Api.SandboxedFileReader.FromFileInfo(FileInfo fileInfo) in ...\SandboxedFileReader.cs:line 31
at DevToys.Tools.Tools.Graphic.ImageConverter.ImageConverterGuiTool.OnDataReceived(String dataTypeName, Object parsedData) in ...\ImageConverterGuiTool.cs:line 138
at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object state)
at System.Threading.QueueUserWorkItemCallback.Execute()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
Environment
- DevToys:
2.0.9/2.0-preview.9(Windows,%LOCALAPPDATA%\Programs\DevToys Preview) - OS: Windows 10 Pro, 10.0.28000.1836
- .NET: 8.0.22 (CoreCLR 8.0.2225.52707)
Suggested fix
- Check
FileInfo.Existsbefore callingSandboxedFileReader.FromFileInfo(in all threeOnDataReceivedbranches:StaticImageFile,StaticImageFiles, and the temp file path). - Avoid
async voidforOnDataReceived, or wrap the whole body intry/catchand surface the error in the tool UI. - Optionally make
SandboxedFileReader.FromFileInforeject missing files with a clearer, catchable exception.
Logs
Relevant excerpt from %LOCALAPPDATA%\DevToys-preview\Logs\log-20261120T165521.txt:
2026-11-20T16:55:22.7758604+08:00 Information [DevToys.Core.Tools.GuiToolInstance] [LogInstanceCreated] Instance of 'ImageConverter' tool created.
2026-11-20T16:55:22.7809545+08:00 Critical [DevToys.Windows.MainWindow] [0] Unhandled exception !!!
Unable to find the indicated file.
System.IO.FileNotFoundException: Unable to find the indicated file.
File name: 'C:\Users\Admin\Desktop\门岗新环保新流程.png'
at DevToys.Api.SimpleSandboxedFileReader..ctor(FileInfo fileInfo)
at DevToys.Api.SandboxedFileReader.FromFileInfo(FileInfo fileInfo)
at DevToys.Tools.Tools.Graphic.ImageConverter.ImageConverterGuiTool.OnDataReceived(String dataTypeName, Object parsedData)
Activity