Why does OpenFileDialog freeze WinForms app on a specific machine?
Asked Answered
S

1

5

I have a WinForms app deployed to multiple machines in the same office. Up until this Monday, all users in the office used the app without issue and used the OpenFileDialog to select files to import. One machine had lots of updates to other apps and now freezes when our app tries to show the OpenFileDialog. It shows the OpenFolderDialog fine; though I failed to try the SaveFileDialog. Just to repeat, it worked last week, our app was not updated, but it freezes on one machine this week whereas it works on all other machines in the office.

The machine in question has another .NET app installed and I verified the OpenFileDialog opens without issue in the other app.

Any ideas as to why the OpenFileDialog would freeze on one machine? Any ideas on how to fix this? We could try reinstalling without knowing the cause, but I figured it is better to investigate why to prevent it from happening again.

Segura answered 29/9, 2011 at 20:20 Comment(10)
Have you tried waiting for it to unfreeze? It may be trying to read a network resource that is no longer available.Smote
possible duplicate of C#, WPF - OpenFileDialog does not appearGlider
@HansPassant The cause is definitely not programmatic, such as the parent not having a handle and the Main method not being the STAThread, because it worked last week. I question whether it is AutoRuns or system wide, because another .NET app uses the OpenFileDialog without issue.Segura
@Jacob: We did not wait too long for the app to unfreeze. Would it be trying to read a non-existent network resource from the RestoreDirectory property if that is what it used before? Would it be system-wide such that the other .NET app that uses the OpenFileDialog would suffer the same problem?Segura
@Jacob: If the user is trying to open a non-existent network location, how can I clear it? How long should I wait for it to unfreeze?Segura
Have you read my answer in the linked dup? It was to supposed to make it obvious that this is not a mistake you made.Glider
@HansPassant: I'm not being defensive about the code, just that none of those three answers sound like this problem because it is not system wide. Also, it isn't a WPF app. I am having our support person wait longer to see if Jacob is the winner.Segura
@flipdoubt: Yes, if it's trying to read a non-existent network resource, it could hang for a while. But it should eventually time out. How long before it times out is another question.Appropriate
@Jacob: Waiting worked. You should post your comment as an answer so I can vote it up and mark it as the answer.Segura
Will do. Glad to hear you got it figured out!Smote
S
8

This machine may have connected to a network resource in the past, which is no longer available. OpenFileDialog could be waiting for the network resource to respond, which will take several minutes to timeout.

Smote answered 30/9, 2011 at 18:27 Comment(1)
Can i change this timeout?Hallah

© 2022 - 2024 — McMap. All rights reserved.