OpenFileDialog "hangs" on Windows 2000

I have a WinForms remoted application using a simple OpenFileDialog control.  When I instantiate the dialog, the program hangs and never responds.  This only happens on Windows 2000.  The program functions perfectly on Win XP & Win 98.  The user is running the program as a local Admin, so Code Access Security should not be a problem (it should generate an exception anyway).  Just to be sure, I verified the security.  The code is very simple.  I found one other post relating to this on the web, but it did not have an answer.  Here is the code:  

OpenFileDialog fileDialog = new OpenFileDialog( ); 
if( fileDialog.ShowDialog( ) == DialogResult.OK ) 

  ... 


The program freezes at the call to ShowDialog( ).  Does anyone know what is going on  


Answer this question

OpenFileDialog "hangs" on Windows 2000

  • Mitch Kupferman

    If you can narrow it down to a small example that exhibits the behavior, I'd love to see it. I'm only running WinXP Pro, but I'd be happy to check and see if it hangs there. I actually do have a Win2K box I can try it on, as well. (send to the email associated with this profile).
  • NewbiePhil

    This is a good catch.  I'll open a bug so we can get it fixed in future versions.

    thanks
     - mike

  • MDXXI

    I have had the same problem-- deployed on 50+ machines with no problems- then all of a sudden one hangs.  If I go into task manager and look at the Applications tab the progam is not running, but if I go into the Processes I see that about 8,000 k (program is about 20,000k) has loaded and it stops.

    What has helped most of the machines is that ALL of the windows updates must be in place- including the dot net service pact.  This has fixed all but two machines.

    Still working on those two- when we have the time.

    Maybe this helps some but I know that it is not the answer for all.

  • leo2

    OK, at the risk of sounding really stupid, I'm going to ask a dopey question. Is it possible that the dialog box is hidden behind some other UI element  That would certainly cause the application to appear to hang. I'm not sure what the default "parent" for the dialog box is, but if it's not the current window, it's possible that it could get "buried" under other windows. I could also see this only happening on a particular operating system, if that's the problem. I doubt it is, but it's worth considering... -- Ken
  • Muthu Arumugam

    Don't worry about sounding stupid, Ken.  The dumbest things are usually the ones that cause us developers the most trouble.  The dialog box is not hidden, though.  The main window displays an hourglass cursor and becomes unresponsive.  The Task Manager indicates the program is no longer responding.  The application is using Remoting with a TCP channel to communicate with a server.  It is not doing anything with the remoting infrastructure anywhere near this piece of code.  I have verified that it does hang at the call to ShowDialog( ).  As for the service packs - I have tested this on several Windows 2000 machines.  Each of them has SP3 installed and .NET Framework SP2.  I don't know if I can find one that doesn't have SP3 installed...Each W2K machine has produced the same result - the call hangs.  I created a really small program that just calls OpenFileDialog.ShowDialog( ) as a test and command-line compiled it.  It runs without a problem!  I am not doing anything in particular in my program - the dialog uses all the defaults.  I did create it visually with VS.NET, though.  I'm beginning to think that VS.NET might be causing the issue (how, I don't know).  Thanks for the help so far.
  • Backwards

    Ok, I just tried to repro this bug and couldn't.  What are you doing in your .config file   I ran the following lines of code from a Button's Click event handlerand they didn't hang my app.  

    RemotingConfiguration.Configure(null);
    this.openFileDialog1.ShowDialog();

     - mike

  • Captain Hook

    Has anyone at Microsoft read this thread   This is definitely a problem, although I have worked around it.  This should get fixed.
  • Nagesh_techie

    Ryan, when you say "remoted" what do you mean   Its possible you're doing somehting that is not threadsafe.

     - mike

  • Jim Millar

    OK.  Go figure.  I removed the call to RemotingConfiguration.Configure( ) and replaced it with manually configuring the remoting connection in the code.  Voila!  Everything works fine.  Does anyone out there from Microsoft know what the problem is   I could send you my config file and/or code if you would like.  I think this is an extremely obscure bug.
  • rick_

    I understand you can't reproduce the bug.  I tried to reproduce it with a trivial project using the ***same*** config file as my 2 projects that have this problem, but the trivial project ran just fine.  I did narrow down the source of the problem to the call to RemotingConfiguration.Configure( "xxx.exe.config" ); - all calls before this call work & all calls after it don't work.  I suspect something else may be interacting to cause this problem.  All of this caused me quite a headache.  I can send you copies of my projects that contain this bug if you would like.  Here is a copy of my config file:

    < xml version="1.0" encoding="utf-8"  > 
    <configuration>
    <system.runtime.remoting>
    <application>
    <client>
     <wellknown type="IntranetManagementServer, ContentManagerServer" url="tcp://vistanet:4297/IntranetManagementServer" />
    </client>
    <channels>
     <channel ref="tcp client" />
    </channels>
    </application>
    </system.runtime.remoting>
    </configuration>

  • Ranganathan P

    I would say yes.  Michael Harsh is a member of the winforms team, be certain that if it is a problem, the team will be working on it.
  • Shimit

    I am still having this problem.  I tried a couple more ideas.  I have a splash screen that displays at startup on a separate thread.  I removed the splash screen, but the problem still occurs.  Also, I set the Visible property of the window that displays the OpenFileDialog to "false" before displaying it.  I removed that statement, but the problem still continues.  To answer the question about threading, other than the splash screen, I am not doing anything with multi-threading.  I would be willing to send my code to someone to have them look at it if possible.  Thanks.
  • Rahul Kumar

    I have now confirmed that any calls to OpenFileDialog.ShowDialog( ) hang if they are after my call to RemotingConfiguration.Configure( ).  Any OpenFileDialog.ShowDialog( ) calls before the call to configure remoting succeed!  Further, if I allocate an OpenFileDialog and call its ShowDialog( ) method anywhere before the call to configure remoting, then all subsequent OpenFileDialogs (not necessarily the same one) - even after the Configure( ) call - work without hanging!!!  Again, this strange behavior occurs only on Windows 2000, and the only machines I have been able to test this on are at SP3 for W2K & SP2 for .NET.  My temporary workaround is now to throw up an OpenFileDialog when the application starts if it is running on W2K.  The user then has to cancel the dialog.  After that, all subsequent OpenFileDialogs work normally.  Even worse, I have not been able to duplicate this in a small application.  I created a sample app that uses the same file in the call to RemotingConfiguration.Configure( ) and the sample app works fine.  I am very frustrated with this problem.
  • mgwalm

    Ryan, I just sent you email.  Please forward your project along.

    thanks
     - mike

  • OpenFileDialog "hangs" on Windows 2000