vshost32.exe has stopped working when I call the ShowDialog method of OpenFileDialog

J4N picture J4N · Aug 18, 2011 · Viewed 17.5k times · Source

I've a c# application, I'm doing a final test of it.

But now, a function which has worked everytimes until now doesn't work anymore!

I've a Button, when I click on it I want to browse files, I see the "Open file" windows, and an half second after, I got an uncaught visual studio error:

vshost32.exe has stopped working:

I'm sorry but the error is happening on a french localized computer:

Signature du problème :
  Nom d’événement de problème:  APPCRASH
  Nom de l’application: TOM.vshost.exe
  Version de l’application: 10.0.30319.1
  Horodatage de l’application:  4ba2084b
  Nom du module par défaut: ntdll.dll
  Version du module par défaut: 6.1.7600.16695
  Horodateur du module par défaut:  4cc7ab44
  Code de l’exception:  c0000008
  Décalage de l’exception:  0004631f
  Version du système:   6.1.7600.2.0.0.256.48
  Identificateur de paramètres régionaux:   4108
  Information supplémentaire n° 1:  ffb6
  Information supplémentaire n° 2:  ffb61531feaa1f65f528a2694a510c22
  Information supplémentaire n° 3:  b220
  Information supplémentaire n° 4:  b2205da238309b0a025a25162a3a18f3

My code is:

OpenFileDialog ofd = new OpenFileDialog {Filter = Filters};
if (ofd.ShowDialog() != true) {
    return;
}

it crash just when I'm in the ofd.ShowDialog.

Is this a code related issue?

Do you have any idea about how to debug? Or even how to debug this??

When activating the "unmanaged code to be debug", I got this:

"First-chance exception at 0x77cd631f in TOM.exe: 0xC0000008: An invalid handle was specified."

The stack trace if it could help:

>   ntdll.dll!77cd631f()    
    [Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll] 
    ntdll.dll!77d1792d()    
    ntdll.dll!77ce343b()    
    ntdll.dll!77ce2d80()    
    ole32.dll!776b4102()    
    ole32.dll!776b411e()    
    ole32.dll!7767e505()    
    SearchFolder.dll!1046b49d()     
    SearchFolder.dll!1046b267()     
    shell32.dll!76281cb7()  
    shell32.dll!761701b6()  
    shell32.dll!761991fd()  
    shell32.dll!761d61ee()  
    shell32.dll!761d6159()  
    System.ni.dll!524c4ed4()    
    shlwapi.dll!77b6b6cf()  
    ntdll.dll!77cbb428()    
    ntdll.dll!77cbe6f9()    
    kernel32.dll!77c01114()     
    ntdll.dll!77ceb429()    
    ntdll.dll!77ceb3fc()    

Some things I've tried:

An important new point: It seems that the error doesn't happen when I run it without visual studio(which seems to be logic)

Important point bis: It seems the same code is working in visual studio of another computer(which is exactly the same and issued of the same image of windows

I tried to remove all files and do a GetLatest, but still doesn't work

Answer

Fleg picture Fleg · Mar 13, 2013

I was having the same problem and my solution was to "Enable native code debugging" in "Project properties/Debug/Enable Debuggers" section.

I thought, that I should be able to debug the issue, but instead the error was gone.