VS.NET 2005 C# : IDE hang with simply code...

Today I was doing some small research work with generics in VS.NET 2005 professional RTM and I was just typing normal code when the IDE suddenly locked up, a hardcore hang with 100% CPU usage. After a kill process, I restarted the IDE, loaded the same testproject, went to the same line of code and typed the same text... bam! hangs again!

Now I was a little worried. As this is a little testproject with bogus code, just to try out some generic constructs to see if it all compiles and works out, it's nothing special really so if anything, the IDE should stay up and responsive. Well, not with this killer code apparently.

So, I saved the single code file and re-created a new project (Console, C#) and replaced the generated class' code with the code of my testproject. Completely new project, same code text. Went to the line I wanted to add code, typed in the code, and... you got it, it hangs again.

So, to reproduce, follow the steps outlined in the bugreport, available here. Test code can be retrieved from this link: http://www.xs4all.nl/~perseus/HangUp.cs

Steps to follow:

  1. Create a new C# Console application
  2. Copy the code from the above URL, the HangUp.cs code
  3. Select all code in the generated Class1 class in the console project and paste the copied code into the code window
  4. Go to the line string Value // ... (almost at the bottom)
  5. Remove the comment, and type a {
  6. Wait a second and the IDE hangs
  7. I can reproduce this every time, in Beta2 this isn't happening (on a box with Beta2, it works fine)

46 Comments

  • Confirmed that it happens on my machine as well (VS 2005 Pro RTM)

  • Yes, also reproducible on mine. (VS 2005 Pro RTM / WinXP SP2)

  • I've only had my hands on RTM for a few days and have already seen more bugs than in VS2003 altogether. While it's the best IDE ever, it is also the most buggy IDE ever. Let's hope that they actually use that built-in product update feature this time around. It's been there since v1, but, unfortunately, has never been used.

  • I can't reproduce (RTM, en-US WinXP SP2)

  • Hi Frans!



    Can't reproduce this error on VS 2005 Team Suite Trial (RTM). All worked for me after I try steps you outline, but maybe I do something wrong.



    Anyone elese tried on VS 2005 Team Suite?



    thanks,

    Slavo.



  • Confirmed. Happens on mine as well. Although I only get 50% CPU usage on devenv.exe (And of course, that makes it all better... *rolls eyes*)

  • I can reproduce it, too (RTM, 2k3). The following is a more compact version of the repro:



    ..

    class A<T>

    {

    }



    class B : A<B>

    {

    }

    ..



    Now for example add a property in A<T> and it'll crash.

  • Followed your instructions to reproduce, but didn't hang up.



    (on a box (w2k3 sp1) that had b1 and b2 installed previously I must add)



  • Thanks for the feedback! I'm glad I'm not alone in this, thanks Wilco for the very short repro, although THAT one doesn't hang / crash my IDE... Also I'm glad that there is apparently an IDE setup which doesn't hangup.



    The people who can't reproduce it, do you have settings changed in the IDE, like intellisense preferences which you have disabled or so?



    What concerns me is that the editor has these kind of problems. An editor should at all time stay up and let input be entered.

  • Have to take my previous comment back, Wilco's example hangs it!



  • > although THAT one doesn't hang / crash my IDE...



    Interesting. I changed from the "General Dev Settings" to "C# dev settings", and now my repro does indeed not repro anymore. Yours still does though.



    Switching back to the "General Dev Settings" profile, restarting the IDE and trying my short repro, it crashes again.



    I have tried all different profiles now, and your repro seems to work in all of them here. Mine only works for the general profile and the VB profile.

  • Hello!



    >>The people who can't reproduce it, do you have settings changed in the IDE, like intellisense preferences which you have disabled or so?<<



    No. I installed this just on yesteday and this was just about first thing I try with RTM of VS 2005. I choosed C# IDE settings on first start of IDE. It is VS 2005 Team Suite Trial Edition



    Haven't installed any of previous versions of VS 2005 on that machine. Have VS.NET 2003 there. OS is WinXP SP2 with all latest critical patches.



    Now for interesting part... ;)



    Wilco short example hang my IDE too, when I try add something like:



    public bool IsFixed {



    when I typed brace then IDE hangs.



    strange... still can't reprosuce Frans' long example though...



    thanks,

    Slavo.

  • Wilco: Also in C# settings your sample hangs my IDE, just like in the general profile.





  • The IDE hangs because it encounters an infinite loop when parsing the two classes. Class B is a subclass of A with itself as the template parameter. It's like a snake eating its tail, my head is hurts.

  • Though it's perfectly acceptable code.



    if I have:

    public class EntityBase<T>

    {

    //...

    }



    and then create:

    public CustomerEntity : EntityBase<CustomerEntity>

    {

    }

    it should work, it's possible according to the docs.



    Though with this issue, it can't. An IDE should never hang because of the code typed in. It's the compiler's job to throw errors if something's wrong (and it compiles OK, so it's acceptable code)

  • Your repro makes it happen on my box (VS 2005 Pro RTM on WinXP SP2). devenv goes to 100% CPU. Maybe it's because I have the LINQ Preview refresh for RTM installed with the VS 2005 integration?

  • i am using resharper. it does not hang at first moment since resharper close brace. deleting closing brace will hang ide.

  • Confirmed here too....

    FRESH install of XP with SP2

    VS 2005 RTM installed with minimal customizations, colors, etc...

    NO other Development environments (VB6-VS2003) installed, I moved them all to virtual machines.

  • Yes, confirmed here. VS.Net 2005 Pro RTM. This box had beta 1 and 2 on it at one point. Don't know if that matters. Infuriating.

  • >Suma: well, as you can expect: I can't wait till Orca's for this to be fixed.



    Hahahaha, you couldn't resist, could you?! :)

    But you're right. And because there's already so much known about Orca and so much to do, we already are expecting all bugs to be fixed by Orca :)

  • Frans, I've had performance issues with the IDE (intellisense mainly) too. Nothing like what you've found, and mine hangs too with that code you posted with CPU at 100%. But what is even worse is when I use LLBLGen Pro against our database with about 200 tables, the intellisense crawls when accessing anything in the DatabaseGeneric or Database specific assemblies. It's 10x worse if you include those projects in your solution. Sure, it was sorta slow with VS2003, but it is soooo much worse with VS2005 - almost unusable. Although, LLBLGen does create a lot of overloads in some cases, but I still think that should be accounted for by the IDE software. Hopefully they will have an SP. :-(

  • Sean, yeah the overloads are mainly the same methods with different enum types for the first parameter.



    You can exclude PredicateFactory and SortClauseFactory from the projects btw, and use the new way of creating predicates: CustomerFields.CompanyName=="Foo"; which also work in VB.NET 2005.



    In v2.0 of llblgen pro, I hope to make the amount of generated code much smaller due to generics and partly refactoring :)



    Though in general the IDE is indeed somewhat slower. In the Interfaces.cs file with all my interfaces definitions for the runtime libs, it's indeed getting slow at times, almost as slow as the early resharper versions...

  • Hi Frans,



    I'm Cyrus, the developer primarily responsible for IntelliSense in C# 2005. It's a bug in my code that's leading to the hang that you're experiencing. Basically the issue is that we're in the process of doing a graph traversal during our incremental binding and as the graph is infinite regular graph coloring algorithms fail and we end up taking forever.



    Why is the graph infinite? Well, consider a simple case like:



    class ISet<T> : IMap<T,T> { ... }

    class IMap<K,V> : ISet<ITuple<K,V>> { ... }



    Pretend we're trying to determine the super type chain of IMap<K,V>. Well, first we say its: ISet<ITuple<K,V>>. But ISet<ITuple<K,V>> is an IMap<ITuple<K,V>,ITuple<K,V>>. But what's that? Well, it's an ISet<ITuple<ITuple<K,V>,ITuple<K,V>>>. But what's that? Well it's an IMap<...



    Well... you get the idea.



    The compiler is unaffected by this as it does a prescan first to detect these kind of infinite graphs and it truncates them.



    However, due to the incremental nature of IntelliSense (where we're constantly changing the graph) we do thignsl slightly differently and we got caught by this particular case. (it should be noted that in all the other infinite lookups due to generics we *do* correctly detect this problem and terminate what we're doing). Note: that's not trying to excuse this current behavior. It sucks and i'm really sorry that you're running into it.



    As suma mentioned, this was caught very late in Whidbey and it was felt that there wasn't enough time to fix it and test everything to ensure that the product would be ok.



    We're discussing right now what we can do abotu this (both for orcas, and possibly before). Id' be happy to chat more about this if you want. I'll try to check back in with your blog every now and then. If i don't, please ping me through the contact link on my blog so that things don't go unnoticed.

  • Frans: " In the Interfaces.cs file with all my interfaces definitions for the runtime libs, it's indeed getting slow at times, almost as slow as the early resharper versions...

    "



    Can you file a bug on this at msdn.microsoft.com/ProductFeedback

    ?



    Please tell us what kind of hardware you're using as well as the interface definitions file and we'll attempt to repro this and address whatever issue you're seeing.

  • Suma: Next release !??!?!? this is totaly unacceptable. move your asses ASAP and get a hot-fix out the door YESTERDAY!!!

    don't give us this we will fix the bug in 'next release', WTF !?!??!?

  • Kudos to Cyrus for (a) fessing up to owning the bug and (b) for explaining exactly what the problem is and why they decided against a quick fix that might be more destabilizing.



    Now you only need to come up with a patch soon, and I'll be drinking the MS koolaid again.

  • Man this vs 2005 and .net is so buggy and that just after playing with the RTM for a few hours ...



    Beside crashing the web worker process they didnt even bother to fix the Merge feature of the dataset when you try to merge DataRows from another dataset with the same structure .. It just keeps creating a second table instead of merging ...



    Thanks MS as this bug was reported since a while .. But I guess they just rushed out this release, which is really bad I simply cannot trust a product like that ... Now be quick for the fixes ...

  • Neat, I can repro on Win2k3 SP1 VS 2005 Pro RTM (a clean install).



    I've been using VS 2005 RTM for the last week and haven't noticed any problems. (Just been doing fairly simple ASP.NET 2.0 stuff.)



    The only problem I've found that seems to creep up at least once a day (and it's very, very minor compared to this humdinger, almost embarrassed to bring it up in this thread, but....), is that in the Design view there are times where no matter what control I select, it won't refresh the Properties window. Usually closing the file being edited and reopening it fixes this...

  • Cyrus: thanks for taking the time to clarify this issue and also respect to you for stepping forward and admitting you made the mistake. Yesterday I realized it must be really frustrating for you that you know you made a mistake somewhere (we all do, nothing new about that in programmers land ;)) but that you're not allowed (!) to fix it so potentially millions of people can run into this issue.



    Now I know what the reason is for this issue I can avoid it, at least I hope I have avoided the constructs which lead to this issue when I type a '{' somewhere :).



    To solve this I think it would be best to release patch roll-ups on a regular basis. In VS.NET you have that great check for updates feature, which could pop up to install the latest roll-up of the patches. I think I speak for a lot of people if I say it's unacceptable to wait for Orcas for a fix for this or other issues with VS.NET 2005. It's abit frustrating but part of life that there are bugs in a software package, so in a way acceptable. What makes that 'acceptance' a real nightmare is the knowledge that you have to live with these annoyances and bugs for a long period of time. Especially because there's no alternative: to which IDE/development environment can be switch to to avoid the bugs? That's why I hope MS will listen and start an initiative to distribute patches on a regular basis to their developer tools customers.



    -----

    About the slowness in the editor: I'm on a 3Ghz box (Xeon) with raid0 scsi disks and 1gb ram (an expensive dell box, so it has a proper layed out motherboard with no bottlenecks in buses and DMA). So you can say: if it's slow here, it's slow. ;).



    VS.NET 2005 is pretty snappy, it sometimes gives you the feeling it's a tiny bit slower than vs.net 2003, but it also offers more functionality, so that's perfectly fine by me. However, in larger files it gets slow after a while. With slow I mean: it can't keep up with the typing. (inserts text sometimes a second after I typed it). The interfaces file I talked about is 4200 lines long and has a lot of interfaces defined inside it.



    As I'm currently refactoring .NET 1.1 code to .NET 2.0, the project doesn't compile (it's our runtime library for our O/R mapper, and contains roughly 60,000 lines of code, so not that big). Though in the interfaces file, the one where I'm working on right now, I see slowdowns in the typing response of the editor.



    I'd love to create a bug report in ladybug though I'm not going to attach the sourcecode so everyone can download it. Can I send it to you instead?

  • Frans: Sure. I'd really like to see what you're running into. I'd also like a chance to chat with your privately about a few things. So please contact me through my blog so we can work through all of this.



    As to the subject of patches... well... all i can say is that i totally agree with you. However, i think the community needs to send a clear message that updates, fixes and timely SPs are very important to you. If that message is made then it will be acted on (from up on high to down low in the trenches :) )

  • I'm the Product Unit Manager for C#. Frans and others -- I am sorry that you have encountered this bug. We work hard to ensure a high level of product quality, and it is disappointing to hear that you are encountering this issue.



    We are investigating a "hot fix" for this today, and will provide an update when we know more.



    We hear the feedback for more frequent service packs for Visual Studio loud and clear. We plan to have a service pack for VS 2005 in the first half of 2006. Thanks.



    --Scott

  • I should have also stated the plan for servicing VS 2003. We are far along in our work on VS 2003 SP1, and are planning to release it in April 2006. Thanks.



    --Scott

  • Thanks for the information, Scott! Much appreciated :) It's great news Microsoft finally takes service packs seriously for vs.net and that service packs will be released :)

  • I could repro with VS Team Edition for Software Dev (fresh install) under WinXP Tablet PC 2005 with the C# developer IDE default settings.

  • No product of sufficient complexity would ever ship if the criteria were that it be bug-free, and this is where they had to draw the line. This problem isn't unique to Microsoft.



    Asher: Instead of giving orders is such a rude manner, perhaps you should show some initiative and get off your a** and help them, if this is such a trivial thing to fix? Really, I double-dog dare you. These people have to go home *sometime* in their lives, so unless you're planning to personally cover their salaries while they take orders from you, perhaps you should express your disappointment in a more professional manner.



    "Orca's": That's "Orcas", pronounced by the natives as "OR-kuss" (don't ask us to explain the pronunciation of "Sequim"). Like Whidbey, it's an island in Puget Sound. A rather pretty one, I might add, last I was there.



    MS: Hotfix would be preferable, of course. Thanks for looking into it.

  • I can produce this bug too. This for sure is a "stopper" bug!! I guess none of MS QA people created template class with property for it. If I were MS's product manager, I would release a hotfix of this bug. This is definitely going to affect manay people. It is a shame!

  • Hotfix is in the works at the moment. No idea when/if it will be available for everyone, I hope to post a KB number (which should lead to the information where to obtain the hotfix) soon.

  • I have the same problem as well. Wow. I wonder whats its doing?

  • I have...same bugs...mmm..what a surprise !:P

  • Frans,



    When you get a KB Number, shoot it to me, and I'll announce it on www.kbalertz.com



    If it's a standard KB, it'll go out automatically, but if it's a KB that you author, then it's not automated.



    Please let me know if you get the hotfix.

  • Scott: will do :) The fix is done, the hotfix is released soon, it's a discussion now whether it will be public (good) or not (bad). Either way I'll blog about it and will send you the KB number :)

  • You guys need *code* to crash VS? I think I'm WAY ahead of you -- I just got VS2005 Standard edition RTM from the MS Launch event. I thought I'd do a little exploration with it and write a couple utilities for my PDA.



    So I install the full VS2005 Std. & MSDN library.

    I finish the install, restart the PC, defrag

    the disk, then before I go to sleep I start up

    Visual Studio just to make sure it launches.

    Ok, it starts, the IDE displays, and it loads its default www page on startup.



    I decide I'm too tired to do any more coding /

    checking it out, so *all* I do is go into the

    Preferences / Options, change to the

    setting that tells it to load an

    "blank workspace" instead of the default WWW

    home page on startup. I save that change,

    exit VS2005. Now, the next day, I rebooted

    the PC, and tried to load VS again. *BOOM*

    100% repeatedly when I try to load the program it displays its splash screen and instantaneously that's covered up with an crash/error handler dialog --

    "Microsoft Visual Studio has encounteed a

    problem and needs to close"

    AppName: devenv.exe AppVer: 8.0.50727.42 AppStamp:4333e699

    ModName: msenv.dll ModVer: 8.0.50727.42 ModStamp:4333e919

    fDebug: 0 Offset: 0000e745



    It doesn't matter if I start it from the

    START menu, or by clicking on a .cs file or

    anything else, all it can do now is instantly

    crash. I even manually edited the

    "General.vssettings" XML file to change the

    startup behavior in case it was that change that I made that causes the bug, no, as far

    as I can tell it doesn't effect it.



    So, yes, VS2005 blows up without even a SINGLE

    line of code EVER having beed viewed / edited /

    compiled by its IDE. Way to go Microsoft,

    I thought I needed my new AMD-X2 dual core

    PC to accellerate your applications, but with

    new VS2005 technology you can make them crash

    faster than the blink of an eye!

  • FTR, happens to me too.

  • Is there a KB about this at last?

  • No KB out yet, and for what's worth: the fix won't be public, you will have to call PSS.



    Great way to deal with customers... :/

  • i just open vb.net 1.1 by clkg the program menu, forgetting that i had moved some folders containing applications i had tinkad with eureka a see sometin like a blue screen of "debt" when i click on the link for one of those applications- instead of the normal startpage i see a full screen slide displaying my error path. is this fun stuff or what?

Comments have been disabled for this content.