✅ Lag after closing folder dialog in console application
I need to raise a folder dialog within a console application. It works if I add the
[STAThread
attribute to the main method. However, there’s consistently a 3-5 second delay after the folder dialog is closed.
This Stack Overflow question bring up a similar issue for OpenFileDialog
but without a concrete resolution.
https://stackoverflow.com/questions/41894044/closing-a-openfiledialog-causes-application-to-hang-for-3-4-seconds
Is there any way to remove or minimize the delay after the folder dialog is closed?
Project Settings
Code
Stack Overflow
Closing a OpenFileDialog causes application to hang for 3-4 seconds
In my WPF application which uses the Caliburn.Micro and MahApps.Metro frameworks, i open instances of OpenFileDialog from the System.Windows.Forms namespace. After opening and closing this dialog, ...
12 Replies
@Mayka what about using FolderBrowserDialog
@leowest I seem to have the same issue with
FolderBrowserDialog
. I also tried running the compiled exe outside of VS in case the debugger was to blame, but it has the same lag.sounds like an isolated issue you're having
yeah I tried a few different things but I cannot reproduce your delay
@leowest what OS version are you on? Trying to figure out if this is an OS issue.
@leowest well we’re actually on the exact same OS build, so I guess that’s not it :OOF:
and I have not reinstalled since 2020 so 😛
@Mayka do u have antivirus that could be potentially doing some realtime check
and it could maybe catch that build and delay it
some times AV does weird stuff
@leowest this is a work computer, but it’s definitely an issue with mine specifically. I had my coworker try the same exe and they didn’t have a delay either. UGH!! I hate when I chase my tail after the completely wrong thing. My hunch tells me it has to do with the same issue I experience where if I create a new folder or delete a file in File Explorer, the changes never seem to show up for me until I hit the Refresh button. I thought maybe it was my local icon cache, but deleting that didn’t fix the issue.
@Mayka can u try resetting the theme of your windows?
kind random but
@leowest after extensive troubleshooting, OneDrive seems likely to have been the culprit, possibly due to a corrupted SharePoint shortcut. Since removing it, File Explorer is auto-synching again with file system changes, and my C# code is no longer hanging after I’ve closed the folder dialog.
Thank you very much for your help with this! Determining it was a setup issue rather than a C# issue helped lead me down a path toward a solution.
no worries thanks for letting me know what the cause was dont forget to throw a /close here 😉