Friday, October 12, 2012

Worst Visual Studio 2010 Bug I Have Ever Seen

The Background
This bug was so bad I had to post about it. This is by far the WORST Visual Studio 2010 (VS2010, VS) bug I have ever seen in my life. No one likes bugs, but we can arguably say that some bugs are preferred over other if given the choice. So there are bugs that pretty much everyone has encountered such as random program shut downs. You are using it and then *poof* it is gone. Visual Studio 2003, 2008 and 2010 have all done that to me for one reason or another - it is just irritating, but much more than "#@$@% now I have to open all my crap up again!"

Well, I have found the mother of all visual studio bugs - the worst part is I don't know if it is limited to just my system or if anyone else can reproduce it. I know I can reproduce it, but trust me I don't want to. What I am about to uncover is going to sound ridiculous, but it is what happened:

Perfect Storm Conditions
My Conditions:
  • Visual Studio 2010
  • Web Application 
  • Web Application is hosted in IIS7 locally for testing
  • HTML Editor is Open for an ASPX file
Awakening the Beast
All I did, I kid you not, is write the following statement (click to view):


This reads:
<ItemTemplate>
 <asp:HyperLink ID="lnkAllocation" 
       NavigateUrl='<%# Bind("ClientID", "~/AllocationDetails.aspx?clientID={0}") Bind("AllocationID"), "&allocationID={0}" %>'
       runat="server"
       Text="Details" />
</ItemTemplate>

I don't want to get into what I was trying to accomplish because that is no excuse for what happens next.

The Horrific Symptoms
After copying and pasting that information in, Visual Studio 2010 froze for about 5 solid minutes. After that delightful event, I thought VS was just taking a crap like it does so often. No, it was much worse - after the 5 minutes it came back. "Okay..." I thought - that was weird. I try loading my site in my browser and nothing - just kept spinning. I thought maybe my cached IIS files were corrupted, so I cleared them out. Tried again.

This time I noticed that my whole PC was freezing up. I checked CPU usage, w3wp.exe (IIS7 Worker Process) was using 50% CPU on my 8 core machine. One of the cores was being maxed out, thrashed! That is horrifically bad. Still not understanding what happened. I restarted IIS, tried again, same problem.

I tried using IIS Express (formerly known as Casini). Same exactly behavior - the process named WebDev.WebServer40.EXE was now using 50% CPU, yay for CPU Thrashin!

What ever the hell it was that was causing this had everything to do with what I just pasted in. This partially makes sense - but holy shit - WHAT A BUG!

The Stupid Fix to the Stupid Problem
I deleted the code. The problem psudo went away. Every time I would paste something into VS, the whole IDE would hang for 5 minutes or more. I restarted VS and all was well at that point. Sadly, I could reproduce this behavior, because I needed to make sure what I just witnessed was real. I spent about 2 hours figuring this out because I couldn't get any work done until it was fixed. Talk about incentive.

The Gotcha
I have to do more research as to why this happened, but for now, all I can say is NEVER EVER try to bind two values to a single control's property! Microsoft should really fix this, but they probably won't - they are working on VS2012 - much like 2K won't fix the audio bugs for Bio Shock 2 because they are too busy working on DLC and new games. Not cool.

No comments:

Post a Comment