I am using Visual Studio Community 2015 and have recently begun to experience a problem when using the OpenFileDialog
control. I can run a debugging session on my program two or three times and use OpenFileDialog
without problems. After that, whenever I close the main form, the debugger does not terminate. Clicking on the "Stop Debugging" button has no effect for about 20 seconds and then I get a messagebox
:
The debugger was unable to terminate one or more processes.
[9408] .....vshost.exe: Access is denied.
The debugger may be unstable now. It is recommended that you save all files and exit.
After closing this box, the system again hangs for quite a while before returning to the code editor.
In the Immediate Window is the message:
Exception thrown at 0x752F3E28 (KernelBase.dll) in WindowsApplication1.exe: 0x000006BA: The RPC server is unavailable.
In the Output Window under "Diagnostics Hub" is the message:
Invalid operation detected by >'StandardClientTransportConnection.SendCustomMessage'.
Following advice in posts with similar problems, I have used Autoruns.exe
to disable ALL explorer extensions. This has not solved the problem.
Does anyone have any suggestions on how to diagnose this issue?
I am now satisfied that the problem was caused by an incompatibility between the anti-virus product and the VS Debugger. It may be pure coincidence, but there exists another product called "Device Monitoring Studio" which documents an Interface/Method "IConnection.SendCustomMessage", so perhaps this and the AV product are related in some way.
You can try creating the OpenFileDialog at runtime. With a using block the object will be disposed automatically. This may do a better job cleaning up its resources than the persistent control on your form.
Using ofd As New OpenFileDialog()
ofd.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*"
If ofd.ShowDialog() = Windows.Forms.DialogResult.OK Then
' user chose a file
Else
' user canceled out
End If
End Using ' the ofd object is disposed
User contributions licensed under CC BY-SA 3.0