by Gaspar Nagy, published in SpecFlow Newsletter #1
You select a keyword in a Gherkin file. You want to replace it, so you just start typing in another one, and … Visual Studio hangs. It does not close, it does not offer you to send an error report and it also does not get gray and irresponsive. It just looks as normal, except that you cannot do anything anymore with it, except for killing the process from task manager. Very annoying. And it just happens sometimes. Randomly.
Although it happened really rarely to me, many SpecFlow users reported that they had this issue frequently, so I decided to fix this issue. The issue that became the highest user activity ever in this project (47 comments in 3 issues). It cannot be that hard to fix – I thought.
After I have learned how to reproduce the issue with higher probability, it turned out that it does not appear during debugging. It was clearly a deadlock, but still: attaching the debugger to a frozen Visual Studio instance did not show anything. All threads looked normal.
I have tried to narrow down the issue by commenting out half of the SpecFlow VS integration, but the only thing I could figure out is that it is somehow related to Intellisense.
Visual Studio 2012 has new testing features that are done by Peter Provost’s team. We have been in contact with Peter several times and he (and in fact the entire team) was always very helpful to us. So after three days of struggling we decided to play out the Provost-card, and contacted him (even though this was clearly not a testing related problem). We’ve got new contacts from the VS team, we have been exchanging big coredump and trace files, but still without luck.
I still don’t know what the problem is… but when I was already so close to give up, I have found an example in the VS SDK, that was about to replace the standard Intellisense popup dialog with a WPF-based shiny blue one. I thought I will integrate this into the project, maybe I will finally see some exception or anything that brings me closer to the solution. But surprisingly, instead of seeing an exception, I haven’t seen anything. The editor worked like a charm, even after two hours of heavy testing.
The bug was gone, but my solution looked like a battlefield after war, so it needed several hours of branching, cherry picking, refactoring and testing until it turned into a useable solution. Also I had to remove all the chromes from the VS SDK sample Intellisense popup, so that it looks like the good old (COM-based) Intellisense popup.
It took me two weeks to create the first version of SpecFlow. Now fixing this issue was probably not two weeks (I did not dare to sum it up), but close to that. So whenever you type in a keyword to replace another one, you can be sure that this is the most expensive keyword ever.
PS: When I explained this story to some friends, they were laughing: “Now you have replaced the built-in Intellisense popup with a custom one. Maybe the original bug has been fixed, but you surely will get many new ones!”