First-chance COMException thrown at application startup but cannot break to find out where/why it's happening

c#, visual-studio

Solution

Sounds like the error is occurring within Visual Studio's attempt to host the process. First Chance exceptions can be caught and handled by applications without further problem. The Output Window is just displaying it has happened. I wouldn't worry about it. Maybe an update to Visual Studio in the future will resolve this.

I would not expect it to occur at Runtime outside of the Visual Studio host process.

Problem

Using: Visual Studio 2012, .NET Framework 4, Windows 7 x64 Sometimes, upon starting my application in debug mode, I see the following line in the Output window: A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in Microsoft.VisualStudio.HostingProcess.Utilities.dll This happens approximately once in every 10 startups and appears to be random (no code is changed, I can just Start, Stop, Start, Stop, etc. until I see the error in Output). I would like to know what is causing this first-chance exception. I have the option "Tools->Options->Debugging->General->Enable Just My Code" disabled and I have enabled the "Debug->Exceptions...->Common Language Runtime Exceptions->System.Runtime.InteropServices->System.Runtime.InteropServices.COMException" option (see screenshot below) in order to break upon getting the exception, but Visual Studio does not break so I don't know where the issue is. I've tried placing random breakpoints in my code but it seems that whenever I actually have a breakpoint set then the exception doesn't occur.

Original source

Related problems