VB and F# support on Windows Phone 7

Have you also heard the rumor that VB and F# is not support on the new Windows Phone 7? Well, Justin Angel, a Silverlight expert, disagree and in this post on his blog he showed that you indeed can use those languages to develop WP7 applications. Check it out it’s a pretty cool workaround.

I must admit that I was a bit skeptic at first since the normal problem with supporting VB on a device that only implement a part of the .Net Framework (such as XNA for writing games for the X-Box) is to include Microsoft.VisualBasic.dll since it, as opposed to Microsoft.CSharp.dll, has a lot of references to other parts of the framework which might not be included in the limited version.

Now, it is actually possible to remove the reference to Microsoft.VisualBasic.dll in a VB project if you use the command line compiler but the problem with doing so is that the CType operator in some cases must use it. Yes, you read it correctly, CType sometimes need to do the conversion during run-time and must then call an internal function in Microsoft.VisualBasic.dll. If you, for example, would convert an integer to a double that would then be handled at compile time and the conversion would be inline but if you would want to convert an Object type to any more generic type the conversion can’t be handled by the compiler and then the internal VB.dll function will be called during run-time.

Well, according to Justin this is not a problem on a WP7 device since Microsoft.VisualBasic.dll is part of the Silverlight 3 distribution which has been ported to WP7. So this leads to the question why we don’t have “pure” VB support on the WP7 device today? Microsoft has said that VB support is coming but the question still remains.

Anyway, in the mean time, as Justin showed in his post, there is a simple workaround.

Thank you Justin (and an extra thank you to Jim Wooley for mailing me the link to Justin’s post)!

Have fun!

Leave a Reply

Your email address will not be published. Required fields are marked *