Labs » Visual Studio 2010 Extension: Hide « No Source Available » tab

This small extension will prevent the tool window with title « No Source Available » from appearing in Visual Studio 2010, and preserve the focus on the currently active tab.

Alas, along with brilliant improvements such as IntelliTrace, Visual Studio 2010 otherwise displays a tab stating that it cannot find source code where to step into. This is obvious when simply pausing an idle application, therefore it forces the developer to close this window before getting back to the code he wants to modify, which may be a productivity killer.

Finding absolutely no solution/workaround despite an exhaustive digging created an immense frustration and at the same time a good reason to play with the Visual Studio Extensibility framework and accomplish the job myself :) . The result is much fitter than what I could have done with AutoIT (probably an always running background loop checking for specific IDE windows through graphical pattern matching).

Let’s hope this extension will be short-term lived as the Visual Studio development team adds an option to better control this behavior!

This extension should work with all locales of Visual Studio.

Feature requests are welcome here. Official repository here.

You can download the VSIX package directly in the Visual Studio Gallery.

  • Facebook
  • Twitter
  • LinkedIn
  • Google Bookmarks
  • Digg
  • Technorati

7 commentaires à l'article “Visual Studio 2010 Extension: Hide « No Source Available » tab”

  1. Saurus
    25 novembre 2010 | 23:13

    This is excellent, that annoying « No Source Available » screen was killing me.

    Maybe I am just not VS2010 in the right way that Microsoft were expecting but this popup is very annoying.

  2. johann
    10 décembre 2010 | 21:33

    i guess this is only working on english Versions. Tried it with German Language Visual Studio 2010 but doesn’t work.

    Will check back once in a while hpoing for a int fix.

    thx in advance

  3. 11 décembre 2010 | 0:40

    German support was added. Thanks for your feedback.

  4. Jafin
    15 décembre 2010 | 6:46

    Oh how I wish there wasn’t a need for this addon. But THANK YOU for writing it. Lets hope one day MS acquire your app for $1,000,000 and intergrate it into VS2010 SP1

  5. Bob
    31 mai 2011 | 10:40

    Plz add support to spanish languege.

    Thx so much!

  6. Henri Demers
    16 janvier 2012 | 20:22

    I got another solution for you all. It is a hack but its working well. I love ILSpy and reflector.

    The idea is to change some values in a visual studio package. In this case, i removed a specific delegate the SolutionOpened invocation list of the package. This is preventing initialisation of the NoSourceToolWindow. If it does not listen to the debugger engine, it does not show.

    Hope its helps.

    private void OnBeforeLoadSolution()
    {
    RemoveNoSourceToolWindow();
    }

    private void RemoveNoSourceToolWindow()
    {
    var guid = new Guid(« BEB01DDF-9D2B-435B-A9E7-76557E2B6B52″);
    try
    {
    // Remove the no soure tool window
    // Get the Razor package
    IVsPackage package = null;
    var shell = ServiceProvider.GetService(typeof(IVsShell)) as IVsShell;
    if (shell != null)
    {
    shell.IsPackageLoaded(ref guid, out package);
    }
    if (package == null)
    {
    shell.LoadPackage(ref guid, out package);
    }

    if (package != null)
    {
    // Get the solution opened event handler and remove the NoSourceToolWindowAdapter delegate from it.
    var packageType = package.GetType();
    var eventInfo = packageType.GetEvent(« SolutionOpened »);
    var fieldInfo = packageType.GetField(eventInfo.Name, AllBindings);
    if (fieldInfo != null)
    {
    var eventValue = fieldInfo.GetValue(package) as Delegate;
    if (eventValue != null)
    {
    var list = eventValue.GetInvocationList();
    foreach (var eventDelegate in list)
    {
    if (eventDelegate.Target == null)
    continue;
    var targetType = eventDelegate.Target.GetType();
    if (targetType.Name == « NoSourceToolWindowAdapter »)
    {
    eventInfo.RemoveEventHandler(package, eventDelegate);
    }
    }
    }
    }
    }

    }
    catch (Exception e)
    {
    throw e;
    }
    }

  7. 17 février 2012 | 8:14

    Thank you very much Henri for you contribution; I have rewritten the code of the extension using your idea and it is now much more robust and universal.

    I have published the source code on Codeplex at the same time (see URL in my article).

Laisser un commentaire