0

I would like to preface this by saying that this does not happen on all computers (tested in Windows 7, Windows 8, Windows 8.1) -- just my development machine whether or not I am in debug or release mode, whether or not I am running out of Visual Studio, or running the executable. I suspect that it is not a common issue, not only because it won't seem to break on others' machines, but the lack of people online that have reported this issue in the forums.

This is a WPF MVVM application written in VB.NET in Visual Studio 2012 with the .NET Framework 4.5. The architecture for the application was a customization of Josh Smith's MVVM demo.

In this app, I need the user to be able to select a single file in one place, and in three other places, they need to be able to select a folder. For the single file, I use the Microsoft.Win32.OpenFileDialog, but for the folder selector, I am using three instance of the System.Windows.Forms.FolderBrowserDialog.

Now, the behavior that only seems to be happening on my machine (Windows 8.1 64 bit OS). When I open the FolderBrowserDialog, which is defaulted to the Desktop, as the first action, I can select any folder that is a subfolder of the Desktop and its children. However, when I chose "This Computer" (or My Computer from the old world), the scrollbar on the side of the dialog appears, the UI seems to adjust itself to display all of the drives etc, but it hangs. Nothing in the app is clickable, and I have to stop execution in the IDE, or Task Manager -> End Task when running the exe.

To make matters even stranger, it behaves exactly as it should if I open the OpenFileDialog FIRST, and then chose ANY of the three FolderBrowserDialogs after that.

There ARE some cases of background threading in this app, but before that was added, I was having this issue. I even did what was suggested by ensuring that it ran on the Sta Thread, with no luck.

And now finally the code:

    Private Function GetSelectedFolder() As String
        Dim returnValue As String = String.Empty
        Using dialog As New FolderBrowserDialog()
            Dim result As DialogResult = dialog.ShowDialog()
            If result = DialogResult.OK Then
                returnValue = dialog.SelectedPath
            End If
        End Using
        Return returnValue
    End Function

I'm pretty stumped on this one. Any help would be greatly appreciated. Thanks!

Community
  • 1
  • 1
AaronBastian
  • 307
  • 3
  • 13
  • How long have you waited until something might timeout? I know the timeout for some things (like trying to open a UNC path) can be *very* long. Like a couple minutes sometimes, it seems. Of course, you could always try the non-programming way to troubleshoot this - disable drivers, programs that load on Windows startup, your network adapter, etc., and see if the problem goes away. Developer machines tend to have a lot of crap on them. – Steve May 08 '14 at 12:41
  • I clicked "This Computer" and walked away for 15 minutes with no luck. I will try disabling everything and running and let you know if it works. Thanks! – AaronBastian May 08 '14 at 13:28

1 Answers1

0

I changed my .NET framework to target 3.5 and this fixed the problem for me.

James
  • 1