Today’s tale of Visual Studio shenanigans begins with my supervisor coming in yesterday and pointing out a new issue in our development environment since the upgrade to VisualStudio 2010. Seems he was getting an exception whenever he dragged the content of a data grid out of our application and into Excel 2003. The text of the exception message was:
An exception of type ‘System.Runtime.InteropServices.COMException’ occurred in System.Windows.Forms.dll and wasn’t handled before a managed/native boundary
Additional information: Invalid FORMATETC structure (Exception from HRESULT: 0x80040064 (DV_E_FORMATETC))
I couldn’t reproduce it under my environment initially. In fact, it initially seemed pretty non-deterministic. After some isolation testing, we’d learned the following about how to reproduce the exception:
- It wouldn’t happen with our VS 2008-built app dropping grid data into Excel 2003.
- It wouldn’t happen with the VS 2010 build dropping data into Excel 2008.
- It would happen with the same app built under VS 2010, dropping data into Excel 2003.
The closest I’ve come to grappling with what we might be experiencing comes from a programmer suffering with NUnit exception handling being ignored, and triggering the VS debugger breaking on exception generation regardless of whether there’s programmer handling for the exception or not. For now, I’m only luke-warm about leaving this setting off, if someone stumbles across this posting and has a really good handle on what might be going on here (or can better describe what I’m trading off by unticking this setting), drop me a comment please?