0
votes

I have received the support ticket that makes me (uncomfortably) numb. The WPF application has the following code to remove temporary directory:

try
                {
                    Directory.Delete(dir, true);
                }
                catch
                {
                    // ignored
                }

The main window' dispatcher unhandled exception handler just shows the dialog box with the info on exception (including the stack). And here it is:

System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\xxx\AppData\Local\Temp\6\86248143'. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive, Boolean checkHost) at the method calling Directory.Delete

Can anybody point me out why the exception was not caught in the catch all block?

1
Are you using Visual Studio ?GBursali
The problem in Release mode and happens only at customer site - the exception is not caught in the nearest catch block but propagated until UnhandledExceptionHandler is called - that how i see it from logsRoman Ananyev

1 Answers

0
votes

Just make sure that CheckBox is not checked. It ignores the try catch blocks and "breaks when that exception type is thrown" Note; I guess it was Visual Studio.