Add Reference Dialog Improvements (VS 2010 and .NET 4.0 Series)

[In addition to blogging, I am now using Twitter for quick updates and to share links. Follow me at: twitter.com/scottgu (@scottgu is my twitter name)]

This is the twelfth in a series of blog posts I’m doing on the upcoming VS 2010 and .NET 4 release.  Today’s post covers a small, but nice, change coming with VS 2010 – an “Add Reference” dialog that loads fast.

Add Reference Dialog in VS 2008

The slow performance of the “Add Reference” dialog in previous releases of Visual Studio has been a common complaint that many a developer (including yours truly) has ranted about.

Previous releases of VS opened the “Add Reference” dialog on the “.NET” tab by default – and when that tab was loaded VS would synchronously scan the global assembly cache (GAC) retrieving .NET assembly information.  Because the GAC scan was done on the UI thread, it would freeze the IDE until the scan completed – which meant that you couldn’t cancel the operation, even if you didn’t want to use that tab. 

Because GAC scans can often take awhile (if you have lots of assemblies installed and/or a slow hard drive), you could end up having to wait a really long time for the dialog to respond.

Add Reference Dialog in VS 2010

The Beta2 release of VS 2010 introduces a few welcome changes to the “Add Reference” dialog behavior that significantly improves its performance. 

The first improvement is that the “Add Reference” dialog in VS 2010 now defaults to opening on the “Projects” tab instead of the .NET tab.  This means that the dialog always loads really fast.  If you want to setup a project-to-project reference, or browse the file-system to select a file assembly, etc. you can now select these tabs immediately without having to wait for anything to load.

image

The second improvement is that the .NET and COM tabs now load asynchronously and do not block the UI thread while their lists are populated.  This means that if you accidentally click the tabs you are no longer blocked waiting for them to synchronously load – with VS 2010 you can now either click “Cancel” to close the dialog or click on another tab instead.

image

Hope this helps,

Scott

106 Comments

  • You have no idea how much time that's going to save collectively amongst the entire .Net developer population ;-D

  • This is really really good..
    Thanks

  • The Object Browser is a nice way to add common .NET references to your project for pre-2010 users. It even correctly capitalizes System.Configuration. ;)

  • fantastic news! I tend to use VS powertoys "copy as project reference" and "paste project reference" - nice to see this is no longer needed! great work fellas :)

  • Its all about the small things in life :)

  • It would be great to have an option to filter content on .NET tab - just as new Intellisense feature for object properties. Scrolling take a lot of time.

  • But still lacking XP theming support, causing ugly backgrounds ;)

  • Why not open the 'Recent' tab by default? Or add an option with the option to change the default reference tab.

    @Criss: Items are added in a sorted fashion. Much like 'Installed Programs' in the control panel.

  • This is awesome! Was actually wondering a few days ago if this would be tackled in 2010.

  • Would love to see this for the toolbox, too!

  • Maybe load the System.* assemblies first as they are the most used

  • > Why not open the 'Recent' tab by default?

    Seconded. I never use the Projects tab.

  • Something so simple but something that caused a lot of arghh! moments.

    -- Lee

  • This is just great. I'd allways kept me wondering why this wasn't fixed in some sort of hotfix years ago.

  • This is great. I have obsessive compulsive tab-clicking disorder, which means that I instinctively click on all the tabs in any tabbed dialog irrespective of whether I need to or not. This will make my Add Reference dialog usage much more streamlined.

  • Hi Scott,
    I downloaded the vs2010 beta2 express iso.I am trying to install the visual web developer. after the initial window, i am not getting anything.I am unable to install on my machine.
    My Machine's Config:
    Win XP
    I have both vs2005,08 installed.

    Thanks,
    Santosh

  • I think .NET tab has too many items to scan by human eyes. I wish it to have filtering capabilities as you type, just like .NET Refelector.

  • Why these lists of assemblies, COM components etc. are not searchable? Who remembers full name of component? Why I must remember, that assembly for Word is named Microsoft.Office.Interop.Word or Microsoft.Office.Tools.Word? Please, add search functionality to this dialogbox.

  • hi,
    great work.
    just yesterday when i needed to reference some .net assemblies, i couldn't find it, and after waiting for some time it came up. the scroll bar was slowly increasing. then i realized tat it was workin asynchronous way.

    can we have the same for copy website. the ftp support in vs is very slow and causes the whole ui to get stuck.

  • if the default tab is "project" then this should be the first in the list

    and how about getting back the behavior of 2005 (or maybe 2003) when you could add different type of references in the same type? now i have to reopen the window if i want to add a poject reference after a file reference

  • Great. I also noticed that some refactoring operations (e.g. renaming some method or property) are also much faster than before.

  • This is probably THE best feature in VS2010! :)
    Now only "Initializing Toolbox" remains!

  • Well all's nice Scott but an animated graphic would help understand that loading is underway and when it has finished.

  • Thats good, but it seems that it would benefit from a filter / search field, so it becomes more like the 'Open cache' feature of reflector.

  • great news. now what about the keyboard shortcut configuration dialog. it is still a usability nightmare.

    keep on the good work

    bslave

  • Hello Scott,
    Same was case with when you want to add something to your toolbox. Like I want to add AJAX control toolkit for Toolbox, and when I click "choose items", it takes forever to load. Is this is fixed ?
    Thanks,
    Shail

  • Such a little thing makes such a big difference.

  • small but very required improvement.

  • I always used to go grab a coffee everytime I would open the Add Reference Dialog. Now I have to find other "excuses" to do the same :)

  • While these improvements are great, the fact that the .NET tab isn't sorted means that I have to wait until it finishes loading before I can find anything. Also, it reloads every frigging time rather than caching the results. All you need to do is validate the current list asynchronously rather than reload it. Also also, no searching is lame. So, nice improvements, better luck next time.

  • FI NA LLY!

  • Good news. This was one of those simple things (if not simple - then why the heck not?) you just couldn't figure out why weren't fixed before.

  • small but good change.

  • OK - only a little thing is missing to make this perfect ;)

    Add a filter text box to the dialog - so one can filter the assemblies (especially for the .net and com tab) ...wouldn't that make sense?!

    dominick

  • Thank you for doing this! It's been a royal pain in my butt for years!

  • simple but awesome!

  • Great news! Now... Can we resize the dialog (and all the other ones)? I've never understood why most of the dialogs in Visual Studio are fixed-size.

  • How about a search box in the .NET and COM tabs, like .NET Reflector's "Open Cache" dialog?

    Great work guys, looks like a stellar release!

  • Yes, yes... It really helps!

    @shailatlas,
    No... 'Choose Items' on Toolbox still takes its own sweet time to load in VS 2010.

  • Thanks. This was indeed much awaited.

    Here are Connect entries for requests:
    - Filter: https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=504692
    - Sorting and more: https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=498811

  • THANK YOU. It's all about the little things, and that little thing will save me a ton of wasted time.

  • FINALLY!

    It's nice to be heard... This is exactly what we've proposing for the past 2 years...

    Thank you...

  • fantastic improvment - its improvement on these otherwise 'small' things that improve the overall satisfaction of the user

  • search for assembly/type in add reference would be useful.

  • Where is the filter box?

  • This is going to make me more productive than any of the new language features...

  • Is the first thing I've noticed running vs2010 beta, I'm in a virtual machine and the add reference opened almost instantaneously

    alk.

  • Awesome. Fantastic. Beautiful

    I noticed that choosing items for the toolbox still has the older style synchronous UI. Any plans to change that before RTM?

    Also, +1 for a search box for filtering the references list. It's a very long list this days.

  • Yay! Finally!

    I wouldn't call it a small fix. It's not just about the time it takes (which is a small amount), but about the way it breaks your flow when you open the dialog...and sit...and wait...and daydream...and think about where you're going to lunch...

    Now, how about a patch or a hotfix for VS 2008 to speed it up there as well? I understand that everyone's on a big push to get VS 2010 out the door, but a *lot* of us are still using VS 2008 (or even 2005 in some cases!) and would like to have that same beautifully fast code there too. I can understand if they can't do VS 2005, but VS 2008 just isn't that old at this point, and we'll still be using it for some time to come.

  • Great to have this... But I'd rather have the old behavior back.

    Why? because while the list loads in the background, you have no idea when it's done (drawback #1). You also cannot sort the columns while the list is loading (drawback #2).

    Combined, these two things make the new method worse than the old one, since on the old one you know you had to wait, and you knew when it was done loading.

    With this one, you have to wait anyway (try to pick out your new reference out of 100 choices in random order, while the list is being added to), with the new aspect that you have no idea until when you have to wait.

    The only trick I have come up with to make this bearable is to make the window as tall as possible (thank goodness it's resizeable) so that I can get feedback from the scrollbar on the right. When the scrollbar stops changing size, it's either already loaded up a ton of elements, or it's done loading them.

    Either way, the new behavior comes up short. I'd rather have the old (slow, but deterministic) behavior.

  • Great stuff. Can we get a filter textbox for the com & .net tabs?

  • This alone makes me want VS 2010

  • Thanks! Did you guys get a chance to fix the Toolbox and F1 Help initial open speed as well? Or at least open them on a non-UI thread?

  • I extra bought a new SSD, with the SSD adding references runs like a breeze, but now you do create an investment-hulk of it - shame on you :-)

  • Please add option to search for components (as has been said earlier in the thread)

    These days, anywhere we see >5 items, we want to search, Binary or Binary whatsoever :)

  • Nice Scott, that's awesome,
    A Question,
    About the Add Items to Toolbox that also look for assemblies, is it going to be faster? and Asynchronous? Minimizable? Leftasidable while you are still programming?
    Thanks A lot.

  • Please consider adding search/filtering...

    But still: Thank you.

  • Scott,

    It's a great improvement. I was wondering what would prevent to add an index for .Net, COM tabs so that way it would not need to scan entire GAC, registry every time you open it?

  • Hi Scott,

    Very nice improvement indeed!

    Perhaps another improvement would be to be able to resize that window, because as you can see in the screenshots, each line is not entirely visible, and sometimes you want to know e.g. the path of the assembly, being able to maximizing or resizing the window in such a case is just convenient.

  • Wouldn't it be possible to have filter textbox in the dialog? It would make easier finding the library among, literally, HUNDREDS, of entries. Thanks.

  • @scottgu

    Thank the VS 2010 team for the productivity boost!

  • And why isn't it filterable/searchable?

    If you guys moved that to WPF, then adding dynamic filtering to a list view it is only a few more lines of xaml! if, if, if :)

    aside from the "Browse" tab, is there any reason why it is tabs at all? Couldn't it be a big filterable tree/table view? with either the current tabs being top level tree items (with recent at the top)...

    it is "Better", but it still could be a LOT more useful!

  • Feedback:

    1. UI indicator that the .NET and COM references are still loading.
    2. Ability to filter the references by search string against the assembly name, file name, etc.
    3. Bring back the section at the bottom that permits you to add multiple types of references without having to reopen the dialog.
    4. Add ability to define named reference sets so that commonly used combinations of references can be added all at once.
    5. Improve ability to add references from Object Browser, such as the ability to select more than one assembly, explicitly target a specific project or selected projects in solution.

  • I love the enhancements for the Add Reference dialog. Thanks for the coverage.

  • Nice work.

    Do you think about the toolbox?
    VS 2003 toolbox tabs so useful. Because, when I open a expand a tab, other tabs collapse automatically.
    New versions of toolbox is hard to use. firstly, I have to collapse all tabs when I open visual studio. Second, I have to collapse a tab after using it to use and see other tabs.

    I think, there should be an option for this.I would like to use older version and you may like to use new version.
    Think about it ;)

    Regards,
    Murat

  • My most noticeable performance complaint for VS 2008 is the time that takes the Exceptions dialog to load.
    Also, a feature to save/restore settings of the Exceptions dialog (possibly by introducing multiple presets/profiles) would be a time saver.

  • That should be in Service Pack 2 for VS 2008, seriously...

  • Still do not understand why you haven't introduced a search box on the "nightmare tab" yet - but these changes are certainly welcomed.

  • I think a filtering functionality for filtering / searching for assemblies would be extremely useful. I love the way the Assembly Cache functionality works in .NET Reflector. Similar functionality in the Visual Studio Add Reference Dialog Box would be really useful.

  • This change is worth the upgrade alone! Well done guys.

  • Nice Improvement. That really use to stuck up my project work. Thanks for the update scott.

  • These are great improvements, but two additional features would help

    1) The dialog should be wide enough to see the full name of typical assemblies.

    1) It needs an incremental search/filter box, so the list can be quickly filtered based on just a few keystrokes.

    Connect item

  • "significantly improves its performance", i like it. In vs2008, it may take me half minutes to wait for the dialog.

  • Hi Scott, thanks for another great blog and another great feature. But my big pet peeve with this and other VS dialogs is that, while it is resizable, which is very important - it doesn't *remember* how I resized it the next time I pull up the dialog (in the manner that, for example, the IDE remembers the way I last had it set up). In fact, I want the column widths of the columnar displays on the tabs to be "sticky" as well - I want VS to remember how I've resized the columns. Why? Well, typically, the first column is the name of the project or assembly and it defaults to a narrow size where if you use a naming convention like MyCompany.MyCompanyProject.MyLibraryCategory.MyLibraryName for your solution's projects, there's no way you're going to see the .MyLibraryName. So, you widen the column to see this important info in order to make your selection. The dialog is dismissed. Later you redisplay the dialog. Sigh... you now have to resize the dialog itself back to a wide dialog (and if you have a widescreen display at high resolution - why not?), you click on the tab and ...sigh.... you have to re-widen the column you're interested in again.

  • A feature that should have been there before 10 years. Anyway its welcomed :)

  • That's a welcome change.
    How far we've come...I remember the 2002 version opening by default on the *COM* tab...that was truly painful.

  • A great improvement, but...
    A search/filter textbox on the .NET tab is something that i would find extremely useful.
    It doesn't need to be fancy, just a simple filter. It would make finding the correct .net component so much easier!!!

  • A search box on the .NET tab would be another welcome feature, but I love the asynchronous loading that has been added.

  • Scott,

    Awesome!

    Someone probably mentioned this. But please fix the Toolbox -> Choose Items dialog. Pretty, pretty please make it so you can resize or maximize the dialog. Try locating Infragistics2.Win.UltraWinListBar.v8.1 vs Infragistics2.Win.UltraWinListBar.V9.1. You have to constantly shuffle and reshuffle your columns to locate them. You shrink all other columns so you can read it, then you end up having to readjust to find another component. Please fix this!

  • +1 for the following:

    - Make the list load faster. Why is the GAC being requeried each time? It needs indexing so opening the dialog is instant. There's already a service to nGen assemblies, so why can't this be similar?
    - Filtering as you type, e.g. "SMI" -> "System.Management.Instrumentation" or "Management" lists all assemblies containing that substring. There's no excuse for this not to be in, especially as it's now so prevalent elsewhere in the IDE.
    - Let us choose which tab to open on. We shouldn't need a plugin for this.
    - If near-instant loading of the references list isn't possible, then indication of progress is a must. There shouldn't be the need to keep an eye on the scrollbar, or watch hard disk activity to find out when the search has finished.
    - Add an option to put System assemblies at the top. 9 times out of 10 I want one of these, but I have to scroll 80% down to get at them.

    Thanks :D

  • Both these changes are very welcome improvements.

  • great. And another vote for caching and filtering

  • I like this... most of the time when I need to reference something its either a project or an assembly that I need to browse to. Beginning the dialog at the project tab will definitely speed things up.

  • Hi Scott,

    How about doing a blog on "Static Reflection". I really like reading you blog, examples are simple and short and to the point.

    Thanks,
    Yashwant

  • Finally, its about time

  • Scott,

    That's awesome -- now if you can do the same thing for pressing F1 accidentally (or intentionally), that would be great. I understand it's out of process COM, etc. etc. etc. -- but is locking the IDE for several minutes while the help collection is rebuilt really necessary?

  • very nice improvement. I use to stuck up adding a reference before. Thanks scott.

  • Thanks scott,

    Ths is goign to save tonns of time in the developer community altogether. Atleast now we do not have to wait to get our references added :)

  • I like this improvement

  • It would be even better to pre-populate the lists on a background low-priority thread. I second the requests for filtering the lists. Just a progressive-match textbox to move the selection. If you're feeling awesome how about progressive match supporting wildcards, eg "*Toolk" would show the four System.Windows.Controls.DataVisualization.Toolkit assemblies.

    Really this would be even better if you could right-click an unresolved data-type and select "Resolve DataType" from the context menu with child menus for 'NET, COM, PRojects, Browse and Recent, showing the enhanced Add Ref dialog. Whether the using clause should be automatically added or the datatype rewritten fully qualified should be inferred from whether this would obscure an already imported namespace.

  • Scott, I want to second (or third) some of the mentions for a SEARCH BOX please!

    I even drew a picture: http://twitpic.com/o3rkl

    Remember, there must be a hot-key to set focus to the search box...

    Thanks,
    Michael!

  • Sigh...

    Instead of actually fixing the performance problem, you're going to disguise it by making the assembly reference screen harder to get to. Sorry not to be very excited about this...

  • Another change that will save me lots of time. Thank you.

  • This is really a very good enhancement Scott. Thank you for sharing.

  • What a catch by you guys! i thought i was among few people who were hurt!(don't want to use harsh language with my IDE of heart) with Add Reference slow performance. Thanks a lot. You guys are amazing.

  • Nice one.

    But what about Choose Items in the toolbox? That's still synchronous!!

    Also, maybe a future feature request, but perhaps a quick filter for the add reference and choose items dialog?

  • Finally!

  • Thanks your article.

  • Scott,
    How about adding asynchronous support for when a user presses F1 for help? It is super annoying to accidentally press F1 and then have to sit there for a minute because the IDE is locked until Help is finished loading.. F1 should not lock the IDE.. Thanks for at least this change.

  • Thanks scott..!

    good stuff by your team, may be i think we need to have the default tab as customizable, I have worked on some project where COM was preferred reference and I hated wasting my time from dialog box to load up .net values first before it allowed me to change to COM.

    Just an idea :)

    Cheers

    Sunny

  • Its good because developer sepend a lot of time to add the refrences

  • better if it has 'Progress indicator' on tab itself when its still loading the list. (just like AJAX indicators !!!)

  • where can i open the "add reference dialog"?

  • Thank god!

  • Toolbox sure is a slow one too

  • I have added a assembly in the GAC 4.0 and when i seen in the physical path it was there.
    But where i try to add it to the project thro' Add -> reference , I can't find the assembly. Any idea on it.

Comments have been disabled for this content.