November, 2009

  • Kirill Osenkov

    Visual Studio 2010 Beta 2 Known Issues – Part 2


    This post continues my unofficial list of known issues in VS 2010 Beta 2 (see Part 1). As we continue getting Beta 2 feedback and investigating issues, it's time for another update on the issues we've been seeing. Please keep in mind that due to the volume of the issues, I'm only mentioning the ones I was involved with or consider important.

    Crash during normal editor operation

    There is a rare situation where Beta 2 can crash during normal editing or viewing C# source code. Nevertheless, it happens often enough to become top 1 reported crash for C#.

    I'm very happy to say that we have identified the root cause and are working on a fix.

    Details: This is an extremely complex and hard to reproduce bug involving native code, threading, and working with Task Parallel Library from native code. The new C# IDE feature, Highlight References, is written in managed code and uses TPL (Task Parallel Library) to calculate references on a threadpool thread. However a certain portion of the language service (called the Language Analysis engine) is written in native code, so we had to do some cross-boundary and cross-thread manupulation. Our developers Ian (from C# compiler) and HeeJae (from C# IDE) worked very very hard to investigate the dumps that you folks were sending in and finally they've found the bug. The good news is that as more and more of Visual Studio gets rewritten in managed code, we hope to see less of such bad bugs in the future.

    So thanks to you for clicking that "Send Error Report" button – it really helped us to fix the top 1 reported C# crash!

    Cannot open C# source file: Error message "The operation could not be completed. Invalid pointer." or "Object reference not set to an instance of an object"

    This one is due to the Tools Options Fonts and Colors using a raster font instead of a TrueType font:

    The fix is easy: switch to a TrueType font such as Consolas or Courier New.

    The editor team has fixed this one already.

    The application cannot start (VS black screen)

    Weston writes about this one in detail: 

    This is due to us being unable to read certain profile settings.

    The workaround is basically to run devenv /resetuserdata from the Visual Studio command prompt, but I encourage you to follow the link above for more information (e.g. how to save your settings beforehand).

    This is already fixed as well (now even if the profile contains the errors we will start successfully and deal with the errors).

    TextOptions does not appear in the IntelliSense in XAML designer

    The WPF team has completely rewritten the WPF text rendering to get rid of the font blurryness issue. The old style is still the default, to enable the new mode you need this simple attribute in your XAML: TextOptions.TextFormattingMode="Display". The problem is – TextOptions won't show up in IntelliSense!

    The workaround is to ignore IntelliSense and just build your project – things should just work.

    This has been fixed as well.

    All menus except the File menu disappear

    It happens extremely rarely, but we saw it three times already – the menus are just gone!


    This one is very very hard to reproduce and we're still investigating this right now – for some unknown reason something is messing up the Style or the ControlTemplate for the menus. If you happen to run into this inside a virtual machine, you can really help us investigate the issue by pausing the machine in the state where VS is running and menus are gone.

    Feel free to open a bug on or let me know and we'll send you instructions on how to upload the VM image.

    Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.VisualStudio.Editor.Implementation.IVsGlobalUndoCapableUndoManager'.


    Microsoft Visual Studio


    Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.VisualStudio.Editor.Implementation.IVsGlobalUndoCapableUndoManager'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{305E8709-55B7-4732-B872-1C073AB58047}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).





    Right now we can't reproduce it so we're looking for any help – call stack, minidump with heap, ActivityLog.xml etc. You can read more about the ActivityLog here:

    We'd appreciate any help!

    Expression.Compile generates incorrect code for (int?) conversion

    using System;
    using System.Linq.Expressions;
    class Program
        static void Main()
            Expression<Func<ValueType, int?>> expr = x => (int?)x;
            Func<ValueType, int?> converter1 = x => (int?)x;
            Func<ValueType, int?> converter2 = expr.Compile();
            int? a1 = converter1(null); // (int?) null
            int? a2 = converter2(null); // NRE

    Expected: both the direct delegate and the one generated with Expression Trees should work identically. Actual: the expression tree one throws a NullReferenceException.

    Thanks to controlflow for reporting this! It's a good bug, but unfortunately it will require a risky compiler change that we don't want to take so late in the product cycle. We've postponed the bug for a later release.

    Delegate.Combine doesn't support variance

    using System;
    class A { }
    class B : A { }
    class Program
        static void Main()
            Action<B> b = _ => { };
            Action<A> a = _ => { };
            b += a;


    This program compiles fine but causes an exception at runtime. The CLR team decided to postpone this to a future version.

    Completion List doesn't show up for certain lambda parameters in multiple overload scenarios

    using System;
    using System.Linq;
    using System.Threading.Tasks;
    class Program
        static void Main(string[] args)
            var query = Enumerable.Range(0, 100);
            Parallel.ForEach(query, (i, p) =>


    In this code, IntelliSense doesn't show after p. Another great bug from controlflow. We've fixed this one (it had to deal with picking the right overload of ForEach given an incomplete lambda statement).

    Debugger data tips are leaking GDI handles

    Hovering the mouse cursor over variables during debugging and expanding the nodes in the tips will leak GDI handles. After the Visual Studio process will run out of GDI handles (and each process can only allocate 10,000 handles), it will crash. Usually this happens after 10-15 minutes of intensive debugging with datatips, depending on circumstances. You can watch the GDI handles of the devenv.exe process in the Task Manager (if you select GDI in View –> Select Columns).

    This is a stress bug that has been fixed by the debugger team recently.

    Tooltips on toolbar buttons are not displaying keyboard shortcuts

    As part of the WPF rewrite, we had postponed this work until very late, and only recently have fixed it (post Beta 2). Now all the keyboard shortcuts show up when you hover your mouse over a toolbar button. You will not be able to turn them off though :)

    Printing formatted source code with color is not supported

    This is actually not a bug, it's by design. We had to cut this low-impact feature from 2010 because of tight resources constraints as we've reimplemented the editor from scratch. This feature will hopefully come back in a later release of Visual Studio, maybe as an add-in.

    More High DPI and other accessibility issues

    I just keep finding more and more High DPI issues, hoping that if I find and report them now, you guys won't have to.

    Combobox missing right edge:


    The shell team decided not to fix this because of tight schedule and resources.

    Snippets background poorly visible on High Contrast Black


    The editor team has decided not to fix this because the colors are configurable.

    Silverlight Out-of-Browser settings dialog clips some controls under 120 DPI

    We're looking into fixing this right now.

  • Kirill Osenkov

    A million-dollar pen vs. a pencil


    You know this legend about how NASA spent millions to develop a pen that can write in zero gravity, and the russians have just used a pencil? Well, I was reminded about this by Dejan’s post in response to my post about the Random Gradient Wallpaper Generator.

    I used an O(NxN) algorithm to generate a megapixel image that takes up about 5 MB on my desktop.

    Dejan generated a 2x2 bitmap that takes up 70 bytes and let Windows stretch it with the exactly same effect. If you read my original post, go read this one, you’ll like it :)

  • Kirill Osenkov

    Bezier Curves and Car Manufacturers


    Michael has asked me if it was possible to add Bezier curves to Live Geometry. So I went ahead and added a Bezier tool (and it took me about 30 minutes to do so!):


    This draws a cubic Bezier curve using four points:


    There is something beautiful and elegant about these curves. No wonder industrial designers use it a lot. I actually felt so inspired that I went ahead and used the tool to design a car :) Here's the live view (you need Silverlight 3 to see this), and you can drag the points around:

    This is so fascinating. Maybe if I'm tired of programming I should just design cars? ;) Any recruiters from Subaru reading this?
    I also built in a possibility to pass arguments to Live Geometry using initParams:
    <object data="data:application/x-silverlight-2," 
    type="application/x-silverlight-2" width="100%" height="100%">
      <param name="source" value="LiveGeometry.xap"/>
      <param name="initParams" 
             value="LoadFile=,ShowToolbar=false" />

    That's how I was able to embed Live Geometry into this page so that it doesn't show the toolbar and it automatically loads the car.lgf drawing.

    Finally, here are some important things to know if you want to host a .xap file from another domain:

    • That domain must have crossdomain.xml at its root (so should be accessible)
    • If you're testing this by loading an .html file from a local filesystem, it will just display a white background and won't load the app. Put the .html on a webserver, then it will work
Page 1 of 1 (3 items)