<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>.NET</title>
        <link>http://blog.galasoft.ch/category/4827.aspx</link>
        <description>.NET</description>
        <language>en-US</language>
        <copyright>Laurent Bugnion</copyright>
        <managingEditor>laurent@galasoft.ch</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <creativeCommons:license>http://creativecommons.org/licenses/by/3.0/</creativeCommons:license>
        <item>
            <title>Bug fix: WPF4 project template for #MVVMLight V3</title>
            <link>http://blog.galasoft.ch/archive/2012/01/25/bug-fix-wpf4-project-template-for-mvvmlight-v3.aspx</link>
            <description>&lt;p&gt;Ironically, my last release of MVVM Light V3 was about fixing bugs in templates and making them better. In the process however, seems that I introduced a regression bug in the WPF4 project templates. Yep shit happens.&lt;/p&gt;  &lt;h2&gt;How do I know if I have the bug?&lt;/h2&gt;  &lt;p&gt;Check the Programs and Features control panel, and look for MVVM Light. If the “Version” column shows &lt;font color="#ff0000"&gt;3.0.&lt;font size="3"&gt;&lt;strong&gt;2&lt;/strong&gt;&lt;/font&gt;.19&lt;/font&gt;, you have the bug. If it shows anything higher, you don’t. For instance, the new version with the bug correction is 3.0.3.19. Also, any version 4.*.*.* does not have this bug.&lt;/p&gt; &lt;a title="MVVM Light version check" href="http://www.flickr.com/photos/36917929@N06/6757419835"&gt;&lt;img src="http://farm8.staticflickr.com/7164/6757419835_f830cfcc68_b_d.jpg" /&gt;&lt;/a&gt;   &lt;p&gt;Alternatively, simply try to create a new WPF4 MVVM Light application in Studio. If you see the following warning, you have the bug.&lt;/p&gt; &lt;a title="Snagit Capture for Flickr" href="http://www.flickr.com/photos/36917929@N06/6757445519"&gt;&lt;img src="http://farm8.staticflickr.com/7171/6757445519_ec38c6852f_d.jpg" /&gt;&lt;/a&gt;   &lt;h2&gt;Upgrading&lt;/h2&gt;  &lt;p&gt;To fix the bug, &lt;a href="http://mvvmlight.codeplex.com/releases/view/71278"&gt;simply download V3.0.3.19 from Codeplex&lt;/a&gt; and install. You don’t need to uninstall the previous version.&lt;/p&gt;  &lt;h2&gt;What’s next?&lt;/h2&gt;  &lt;p&gt;I am working hard on V4 and have some nice improvements coming up. Many people have asked me when the “beta” will come out of MVVM Light, and the answer is “soon”. In the coming few days, I will publish a temporary release that corrects a few memory leaks, notably in the Messenger and in the RelayCommand. This will give expert users time to test and report issues. Then I still have a couple of fixes and I will release a release candidate. I won’t add any new feature after the RC, but will merely fix bugs if people find some. Once the RC is deemed stable, I will release V4 and take a deep breath! &lt;/p&gt;  &lt;p&gt;And yes, there will be a V5 &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://geekswithblogs.net/images/geekswithblogs_net/lbugnion/Windows-Live-Writer/Small-bug-fix-WPF4-project-template-for-_14B52/wlEmoticon-smile_2.png" /&gt;&lt;/p&gt;  &lt;p&gt;Happy coding,    &lt;br /&gt;Laurent&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;div style="margin-bottom: -1em"&gt;   &lt;div style="vertical-align: middle"&gt;&lt;a href="http://www.galasoft.ch/"&gt;&lt;img title="GalaSoft Laurent Bugnion" alt="GalaSoft Laurent Bugnion" src="http://www.galasoft.ch/logo/Current/logo_120x30.png" /&gt;&lt;/a&gt; &lt;/div&gt;    &lt;div style="position: relative; top: -36px; left: 130px"&gt;&lt;strong&gt;&lt;a href="http://www.galasoft.ch/contact_en.html"&gt;Laurent Bugnion (GalaSoft)&lt;/a&gt;&lt;/strong&gt;       &lt;br /&gt;&lt;a href="http://feeds.feedburner.com/galasoft"&gt;Subscribe&lt;/a&gt; | &lt;a href="http://twitter.com/lbugnion"&gt;Twitter&lt;/a&gt; | &lt;a href="http://www.facebook.com/lbugnion"&gt;Facebook&lt;/a&gt; | &lt;a href="http://www.flickr.com/photos/lbugnion"&gt;Flickr&lt;/a&gt; | &lt;a href="http://www.linkedin.com/in/lbugnion"&gt;LinkedIn&lt;/a&gt;       &lt;br /&gt;&lt;iframe style="border-bottom-style: none; margin-top: 7px; border-left-style: none; width: 450px; border-top-style: none; margin-bottom: -20px; height: 23px; border-right-style: none; overflow: hidden" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.galasoft.ch/archive/2012/01/25/bug-fix-wpf4-project-template-for-mvvmlight-v3.aspx&amp;amp;layout=standard&amp;amp;show_faces=true&amp;amp;width=450&amp;amp;action=like&amp;amp;colorscheme=light" frameborder="0" allowtransparency="allowtransparency" scrolling="no"&gt;&lt;/iframe&gt;&lt;/div&gt; &lt;/div&gt; &lt;img src="http://blog.galasoft.ch/aggbug/148474.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Laurent Bugnion</dc:creator>
            <guid>http://blog.galasoft.ch/archive/2012/01/25/bug-fix-wpf4-project-template-for-mvvmlight-v3.aspx</guid>
            <pubDate>Tue, 24 Jan 2012 23:40:09 GMT</pubDate>
            <wfw:comment>http://blog.galasoft.ch/comments/148474.aspx</wfw:comment>
            <comments>http://blog.galasoft.ch/archive/2012/01/25/bug-fix-wpf4-project-template-for-mvvmlight-v3.aspx#feedback</comments>
            <wfw:commentRss>http://blog.galasoft.ch/comments/commentRss/148474.aspx</wfw:commentRss>
            <trackback:ping>http://blog.galasoft.ch/services/trackbacks/148474.aspx</trackback:ping>
        </item>
        <item>
            <title>New MVVM Light templates with bug fixes</title>
            <link>http://blog.galasoft.ch/archive/2012/01/02/new-mvvm-light-templates-with-bug-fixes.aspx</link>
            <description>&lt;p&gt;The current version of MVVM Light had a couple of issues in the project templates. The most annoying one was causing a problem when creating new projects: The GUIDs used to uniquely identify the project were in fact not re-generated properly every time, and we ended up with the same GUID in every new project. The symptoms are the following: If you side-load an MVVM Light application, and then side-load another one, you will see that the first one is overwritten. Note however that &lt;strong&gt;this is only an issue when side-loading applications&lt;/strong&gt;: The GUIDs are properly re-generated and overwritten by Microsoft during the app approval process.&lt;/p&gt;  &lt;p&gt;This was not really an issue with WPF and Silverlight applications (which is why the bug was never found until now), however the Windows Phone uses these GUIDs to check if the application is already installed on the Windows Phone device or not. &lt;/p&gt;  &lt;p&gt;I also took this occasion to update the templates with some information in the AssemblyInfo.cs, so that should make it even easier to fill the assembly information.&lt;/p&gt;  &lt;p&gt;I just published a new MSI that corrects the issue. You can install the new MSI on top of the existing one. As usual, there is an MSI for &lt;a href="http://mvvmlight.codeplex.com/releases/view/71278"&gt;MVVM Light V3&lt;/a&gt; and one for &lt;a href="http://mvvmlight.codeplex.com/releases/view/73208"&gt;MVVM Light V4 beta&lt;/a&gt;.&lt;/p&gt;  &lt;h2&gt;Fixing the issue in existing applications&lt;/h2&gt;  &lt;p&gt;If you encounter this issue in existing application, you can use the following steps to correct it. Note that I recommend you to follow these steps for every MVVM Light application.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Start the GUID generator installed with Visual Studio (open the Start menu and type GUID to find it). &lt;/li&gt;    &lt;li&gt;In the GUID generator, select the Registry Format. &lt;/li&gt;    &lt;li&gt;Press the New GUID button and then the Copy button. &lt;/li&gt; &lt;/ul&gt; &lt;a title="GUID generator" href="http://www.flickr.com/photos/36917929@N06/6621147243/"&gt;&lt;img alt="2011010201" src="http://farm8.staticflickr.com/7156/6621147243_e4dc1db068_o.png" width="403" height="424" /&gt;&lt;/a&gt;   &lt;ul&gt;   &lt;li&gt;Open the CSPROJ file in Notepad (or any text editor). &lt;/li&gt;    &lt;li&gt;Locate the &amp;lt;ProjectGuid&amp;gt; attribute. &lt;/li&gt;    &lt;li&gt;Select its content and paste the GUID you previously copied. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;For Windows Phone projects only, in addition:&lt;/strong&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;In the GUID generator, press the New GUID button and then the Copy button. &lt;/li&gt;    &lt;li&gt;Open the file WMAppManifest.xml (in the Properties folder). &lt;/li&gt;    &lt;li&gt;Find the ProductID attribute and replace its content with the GUID you previously copied. &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;Projects exposed to COM&lt;/h3&gt;  &lt;p&gt;Some project also have a GUID in the AssemblyInfo.cs. Open this file in Visual Studio or in Notepad and check if you can see a GUID there. If there is one, copy a new GUID from the GUID generator and replace the old one with the one you just copied. Be careful to remove the opening ‘{‘ and closing ‘}’.&lt;/p&gt;  &lt;h2&gt;That’s it&lt;/h2&gt;  &lt;p&gt;Apologies for this bug, and thanks to everyone who reported it and helped make MVVM Light better.&lt;/p&gt;  &lt;p&gt;Cheers,    &lt;br /&gt;Laurent&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;div style="margin-bottom: -1em"&gt;   &lt;div style="vertical-align: middle"&gt;&lt;a href="http://www.galasoft.ch/"&gt;&lt;img title="GalaSoft Laurent Bugnion" alt="GalaSoft Laurent Bugnion" src="http://www.galasoft.ch/logo/Current/logo_120x30.png" /&gt;&lt;/a&gt; &lt;/div&gt;    &lt;div style="position: relative; left: 130px; top: -36px"&gt;&lt;strong&gt;&lt;a href="http://www.galasoft.ch/contact_en.html"&gt;Laurent Bugnion (GalaSoft)&lt;/a&gt;&lt;/strong&gt;       &lt;br /&gt;&lt;a href="http://feeds.feedburner.com/galasoft"&gt;Subscribe&lt;/a&gt; | &lt;a href="http://twitter.com/lbugnion"&gt;Twitter&lt;/a&gt; | &lt;a href="http://www.facebook.com/lbugnion"&gt;Facebook&lt;/a&gt; | &lt;a href="http://www.flickr.com/photos/lbugnion"&gt;Flickr&lt;/a&gt; | &lt;a href="http://www.linkedin.com/in/lbugnion"&gt;LinkedIn&lt;/a&gt;       &lt;br /&gt;&lt;iframe style="border-top-style: none; margin-bottom: -20px; height: 23px; width: 450px; border-bottom-style: none; overflow: hidden; border-right-style: none; border-left-style: none; margin-top: 7px" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.galasoft.ch/archive/2012/01/02/new-mvvm-light-templates-with-bug-fixes.aspx&amp;amp;layout=standard&amp;amp;show_faces=true&amp;amp;width=450&amp;amp;action=like&amp;amp;colorscheme=light" frameborder="0" allowtransparency="allowtransparency" scrolling="no"&gt;&lt;/iframe&gt;&lt;/div&gt; &lt;/div&gt; &lt;img src="http://blog.galasoft.ch/aggbug/148217.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Laurent Bugnion</dc:creator>
            <guid>http://blog.galasoft.ch/archive/2012/01/02/new-mvvm-light-templates-with-bug-fixes.aspx</guid>
            <pubDate>Mon, 02 Jan 2012 20:13:28 GMT</pubDate>
            <wfw:comment>http://blog.galasoft.ch/comments/148217.aspx</wfw:comment>
            <comments>http://blog.galasoft.ch/archive/2012/01/02/new-mvvm-light-templates-with-bug-fixes.aspx#feedback</comments>
            <wfw:commentRss>http://blog.galasoft.ch/comments/commentRss/148217.aspx</wfw:commentRss>
            <trackback:ping>http://blog.galasoft.ch/services/trackbacks/148217.aspx</trackback:ping>
        </item>
        <item>
            <title>MVVM Light installers and Nuget (including Silverlight 5) #mvvmlight</title>
            <link>http://blog.galasoft.ch/archive/2011/12/18/mvvm-light-installers-and-nuget-including-silverlight-5-mvvmlight.aspx</link>
            <description>&lt;p&gt;I just pushed two big updates to MVVM Light setup components.&lt;/p&gt;  &lt;h2&gt;MSI installers with Silverlight 5 support&lt;/h2&gt;  &lt;p&gt;The MSI installers are available on Codeplex. The current version supports Silverlight 3, Silverlight 4, &lt;strong&gt;Silverlight 5 (new)&lt;/strong&gt;, WPF 3.5 SP1, WPF 4, Windows Phone 7.0 and Windows Phone 7.1. The &lt;a href="http://mvvmlight.codeplex.com/releases/view/71278"&gt;installer for V3&lt;/a&gt; is available, as well &lt;a href="http://mvvmlight.codeplex.com/releases/view/73208"&gt;as the one for V4 beta&lt;/a&gt;.&lt;/p&gt;  &lt;h2&gt;NuGet support including Silverlight 5&lt;/h2&gt;  &lt;p&gt;I also pushed a new version of the NuGet packages which includes Silverlight 5. To install MVVM Light into an existing application with the help of the NuGet package manager in Visual Studio, &lt;a href="http://www.galasoft.ch/mvvm/installing/nuget"&gt;check the instructions&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;If you look for “mvvmlight” on NuGet, you will find four packages:&lt;/p&gt; &lt;a title="" href="http://www.flickr.com/photos/36917929@N06/6532927729"&gt;&lt;img src="http://farm8.staticflickr.com/7149/6532927729_d66b49a854.jpg" width="500" height="333" /&gt;&lt;/a&gt;   &lt;ul&gt;   &lt;li&gt;MVVM Light: The whole package, libraries + ViewModelLocator + MainViewModel. Installing this also modifies App.xaml to install the ViewModelLocator. This package is for V3 of MVVM Light! &lt;/li&gt;    &lt;li&gt;MVVM Light libraries only: Installs only the DLLs and references them. This package is for V3 of MVVM Light! &lt;/li&gt;    &lt;li&gt;MVVM Light [Preview]: This is the whole package too, but for V4 beta. &lt;/li&gt;    &lt;li&gt;MVVM Light libraries only [Preview]: Just the DLLs, for V4 beta. &lt;/li&gt; &lt;/ul&gt;  &lt;h2&gt;Update on V4’s availability&lt;/h2&gt;  &lt;p&gt;One of the most annoying issues in V3 is a memory leak that can appear in the Messenger component in certain circumstances. I will post details in due time, but there is indeed a risk that an instance is not garbage collected if it is registered with the Messenger with a non-static method, and if the developer omits to unregister the instance before deleting it.&lt;/p&gt;  &lt;p&gt;Because of the promise of a “weak” registration, I really want to solve this issue. Currently, I am able to completely solve it in WPF, and to solve it in most cases in Silverlight (including Windows Phone). There is still one special case in Silverlight where a memory leak may remain, and I am currently working on handling this. I am not sure that there is a solution for this last scenario, but there are other alternatives that it is not a blocking issue anymore.&lt;/p&gt;  &lt;p&gt;Once this fix is fully tested, I still have a few things I would like to add in V4. However I am also aware that we have been in beta (and alpha) for quite some time already, and it is very possible that I procrastinate some of these features into V5.&lt;/p&gt;  &lt;p&gt;Happy coding!    &lt;br /&gt;Laurent&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;div style="margin-bottom: -1em"&gt;   &lt;div style="vertical-align: middle"&gt;&lt;a href="http://www.galasoft.ch/"&gt;&lt;img title="GalaSoft Laurent Bugnion" alt="GalaSoft Laurent Bugnion" src="http://www.galasoft.ch/logo/Current/logo_120x30.png" /&gt;&lt;/a&gt; &lt;/div&gt;    &lt;div style="position: relative; top: -36px; left: 130px"&gt;&lt;strong&gt;&lt;a href="http://www.galasoft.ch/contact_en.html"&gt;Laurent Bugnion (GalaSoft)&lt;/a&gt;&lt;/strong&gt;       &lt;br /&gt;&lt;a href="http://feeds.feedburner.com/galasoft"&gt;Subscribe&lt;/a&gt; | &lt;a href="http://twitter.com/lbugnion"&gt;Twitter&lt;/a&gt; | &lt;a href="http://www.facebook.com/lbugnion"&gt;Facebook&lt;/a&gt; | &lt;a href="http://www.flickr.com/photos/lbugnion"&gt;Flickr&lt;/a&gt; | &lt;a href="http://www.linkedin.com/in/lbugnion"&gt;LinkedIn&lt;/a&gt;       &lt;br /&gt;&lt;iframe style="border-bottom-style: none; margin-top: 7px; border-left-style: none; width: 450px; border-top-style: none; margin-bottom: -20px; height: 23px; border-right-style: none; overflow: hidden" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.galasoft.ch/archive/2011/12/18/mvvm-light-installers-and-nuget-including-silverlight-5-mvvmlight.aspx&amp;amp;layout=standard&amp;amp;show_faces=true&amp;amp;width=450&amp;amp;action=like&amp;amp;colorscheme=light" frameborder="0" allowtransparency="allowtransparency" scrolling="no"&gt;&lt;/iframe&gt;&lt;/div&gt; &lt;/div&gt; &lt;img src="http://blog.galasoft.ch/aggbug/148076.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Laurent Bugnion</dc:creator>
            <guid>http://blog.galasoft.ch/archive/2011/12/18/mvvm-light-installers-and-nuget-including-silverlight-5-mvvmlight.aspx</guid>
            <pubDate>Sun, 18 Dec 2011 21:10:12 GMT</pubDate>
            <wfw:comment>http://blog.galasoft.ch/comments/148076.aspx</wfw:comment>
            <comments>http://blog.galasoft.ch/archive/2011/12/18/mvvm-light-installers-and-nuget-including-silverlight-5-mvvmlight.aspx#feedback</comments>
            <wfw:commentRss>http://blog.galasoft.ch/comments/commentRss/148076.aspx</wfw:commentRss>
            <trackback:ping>http://blog.galasoft.ch/services/trackbacks/148076.aspx</trackback:ping>
        </item>
        <item>
            <title>MVVM Light template and WCF services (or any ASP.NET application for that matter)</title>
            <link>http://blog.galasoft.ch/archive/2011/12/07/mvvm-light-template-and-wcf-services-or-any-asp.net-application.aspx</link>
            <description>&lt;p&gt;I was recently made aware of a couple of people having issues with WCF services (or ASP.NET applications) when using the MVVM Light project template for Silverlight. There is a blog post and a StackOverflow question, so what exactly is happening there?&lt;/p&gt;  &lt;p align="left"&gt;Well in fact it is pretty simple when you know how Silverlight connects to web services. Due to the security model of Silverlight, the application cannot connect to a web site if it is not originating of this very website. In laymen’s terms, it means that the application can only connect to a web server if it also comes from the same webserver. For example, if the Silverlight application is served by &lt;a href="http://www.galasoft.com"&gt;http://www.galasoft.com&lt;/a&gt;, it won’t be able to connect to, say, &lt;a href="http://www.cnn.com"&gt;http://www.cnn.com&lt;/a&gt; without getting an exception. We talk about cross-domain access restrictions.&lt;/p&gt;  &lt;p align="left"&gt;&lt;em&gt;Of course there are ways around that, for instance a website can specifically give access to Silverlight applications &lt;a href="http://msdn.microsoft.com/en-us/library/cc645032%28v=VS.95%29.aspx"&gt;through a configuration file&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;  &lt;p align="left"&gt;In the case that concerns us, it is exactly what is happening. You see, the MVVM Light Silverlight project template creates a Silverlight application without an ASP.NET host. I didn’t add one because I didn’t want to complicate the template too much. And also, to be honest, because adding a web project is super easy, but of course only if you know how to do, and this is exactly what we will do here!&lt;/p&gt;  &lt;h2&gt;Creating the application&lt;/h2&gt;  &lt;p&gt;The steps to create the application and the WCF service are as follows:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Create the MVVM Light application using the MVVM Light project template for Silverlight. &lt;/li&gt;    &lt;li&gt;Right click on the solution in the Solution Explorer and select "Add, New Project from the context menu. &lt;/li&gt;    &lt;li&gt;From the WCF category, select a WCF Service Application and create it. &lt;/li&gt;    &lt;li&gt;Build the application. &lt;/li&gt;    &lt;li&gt;Right click on the MVVM Light project and select Add Service Reference from the context menu. &lt;/li&gt;    &lt;li&gt;In the Add Service Reference dialog, click on Discover. &lt;/li&gt;    &lt;li&gt;Make sure that the found service is the one you want to connect to, and click on OK. &lt;/li&gt;    &lt;li&gt;In the MVVM Light application, open the file Model/DataService.cs and modify the code as follows: &lt;/li&gt; &lt;/ul&gt;  &lt;pre class="csharp" name="code"&gt;public class DataService : IDataService
{
    public void GetData(Action&amp;lt;DataItem, Exception&amp;gt; callback)
    {
        var client = new ServiceReference1.Service1Client();
        client.GetDataCompleted += ClientGetDataCompleted;

        client.GetDataAsync(1234, callback);
    }

    void ClientGetDataCompleted(
        object sender, 
        ServiceReference1.GetDataCompletedEventArgs e)
    {
        var callback = e.UserState as Action&amp;lt;DataItem, Exception&amp;gt;;

        if (callback == null)
        {
            return;
        }

        if (e.Error != null)
        {
            callback(null, e.Error);
        }

        callback(new DataItem(e.Result), null);
    }
}&lt;/pre&gt;

&lt;p&gt;This code uses an asynchronous service call pattern where the callback (a reference to a method passed as Action by the caller) is saved in the service call. Then when the asychronous call returns (in the Completed event), the callback is retrieved from the UserState. If an error occurred, the callback can be used to pass this error to the caller. Otherwise, a new DataItem class is created and passed to the called.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Details about this pattern can be found in my talks &lt;a href="http://www.galasoft.ch/mvvmvideo1"&gt;Understanding the MVVM pattern&lt;/a&gt; and &lt;a href="http://www.galasoft.ch/mvvmvideo2"&gt;Deep Dive MVVM&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;So why doesn’t it work?&lt;/h2&gt;

&lt;p&gt;If you run the application now (making sure that the MVVM Light project is selected as Startup Project), you will first see a warning dialog and then an exception. What happened?&lt;/p&gt;

&lt;p&gt;&lt;a title="Warning dialog" href="http://www.flickr.com/photos/36917929@N06/6473500843"&gt;&lt;img src="http://farm8.staticflickr.com/7154/6473500843_6dd5be59cf.jpg" width="478" height="185" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;a title="Exception" href="http://www.flickr.com/photos/36917929@N06/6473504667"&gt;&lt;img src="http://farm8.staticflickr.com/7166/6473504667_0302c65c53.jpg" width="408" height="443" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;What happened here is exactly the cross-domain issue I mentioned: The Silverlight application is not explicitly hosted into a web application, so Visual Studio is using an auto-generated HTML page instead, and running it from the embedded web server (“Cassini”). In fact, unless you explicitly specified otherwise, the test page is run in “file mode” instead of HTTP mode. The URI in the web browser window starts with C:\ for instance, instead of http://.&lt;/p&gt;

&lt;p&gt;In those conditions, the access to the WCF service is (justly) denied, and you get a security exception.&lt;/p&gt;

&lt;h2&gt;Correcting the error&lt;/h2&gt;

&lt;p&gt;In order to correct the error, you can either &lt;a href="http://msdn.microsoft.com/en-us/library/cc645032%28v=VS.95%29.aspx"&gt;add a cross-domain policy file&lt;/a&gt; to your WCF application, or host the Silverlight application in the same web project as the WCF service. Let’s do that now:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Right click on the WCF Service application in the Solution Explorer, and select Properties from the context menu. &lt;/li&gt;

  &lt;li&gt;On the left, select the Silverlight Applications tab. &lt;/li&gt;

  &lt;li&gt;Click on Add. &lt;/li&gt;

  &lt;li&gt;Select Use an existing Silverlight project in the solution and make sure that your MVVM Light application is selected in the combo box. &lt;/li&gt;

  &lt;li&gt;Make sure that Add a test page that references the control is checked, as well as Enable Silverlight debugging. &lt;/li&gt;

  &lt;li&gt;Press Add. &lt;/li&gt;
&lt;/ul&gt;
&lt;a title="Configuring the Silverlight application" href="http://www.flickr.com/photos/36917929@N06/6473557623"&gt;&lt;img src="http://farm8.staticflickr.com/7146/6473557623_569d8c0630.jpg" width="500" height="461" /&gt;&lt;/a&gt; 

&lt;p&gt;This creates two new files in your WCF Service application: One is suffixed TestPage.html and the other is suffixed TestPage.aspx. We typically don’t need the ASPX one so you can safely delete it.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Right click on the WCF Service application and select Set as StartUp Project from the context menu. &lt;/li&gt;

  &lt;li&gt;Right click about the HTML test page and select Set as Start Page from the context menu. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By doing this, we force Visual Studio to serve the HTML page and the Silverlight application from the same URL as the WCF Service, and to serve it as HTTP. This is possible because &lt;strong&gt;a WCF Service application is nothing else than an ASP.NET web server running WCF&lt;/strong&gt;. So the same web server can deliver HTML, Silverlight and of course WCF.&lt;/p&gt;

&lt;p&gt;If you run the application now, you will see the following result:&lt;/p&gt;
&lt;a title="Snagit Capture for Flickr" href="http://www.flickr.com/photos/36917929@N06/6473564443"&gt;&lt;img src="http://farm8.staticflickr.com/7007/6473564443_d68c4eb3fb.jpg" width="500" height="294" /&gt;&lt;/a&gt; 

&lt;p&gt;&lt;em&gt;Note that the warning shown earlier will still appear, but it is really just a warning, and you can safely turn it off. Just remember the cross-domain restriction when you publish your Silverlight application to another web server!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Success, we hit the WCF service and returned with a valid result! In fact, you can verify by placing breakpoints in the DataService.GetData method on the client, and in the Service1.GetData method on the server. Then press F5 to run the application in Debug mode and notice how you can easily debug both the client and the server at the same time.&lt;/p&gt;

&lt;h2&gt;What about the opposite way?&lt;/h2&gt;

&lt;p&gt;It is also possible to add a new MVVM Light application to an existing WCF Service application with the following steps (I am going a bit faster now, I am sure you will get it easily):&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Open the existing WCF Service application. &lt;/li&gt;

  &lt;li&gt;Right click on the Solution and select Add New Project. &lt;/li&gt;

  &lt;li&gt;Select the MVVM Light project template for Silverlight and add a new project. &lt;/li&gt;

  &lt;li&gt;Build the application. &lt;/li&gt;

  &lt;li&gt;Just like before, add a Service Reference to the Silverlight application. &lt;/li&gt;

  &lt;li&gt;Again, just like before, add the Silverlight application to the WCF Service application (WCF Project Properties, Silverlight Applications, Add…). &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Summary&lt;/h2&gt;

&lt;p&gt;Hopefully the confusion around this is cleared now. In summary:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Silverlight applications are restricted to access cross-domain web servers (unless explicitly authorized to do so). &lt;/li&gt;

  &lt;li&gt;The default MVVM Light application does not have an explicit host, so it runs off the default test page. &lt;/li&gt;

  &lt;li&gt;You can however easily add the MVVM Light application to the WCF Service application and then run it and debug it. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Note that the steps above can be used to add an MVVM Light application (or any Silverlight application) to any ASP.NET application, be it WCF Service application, ASP.NET MVC application or “classic” ASP.NET application.&lt;/p&gt;

&lt;p&gt;Happy coding! 
  &lt;br /&gt;Laurent&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;div style="margin-bottom: -1em"&gt;
  &lt;div style="vertical-align: middle"&gt;&lt;a href="http://www.galasoft.ch/"&gt;&lt;img title="GalaSoft Laurent Bugnion" alt="GalaSoft Laurent Bugnion" src="http://www.galasoft.ch/logo/Current/logo_120x30.png" /&gt;&lt;/a&gt; &lt;/div&gt;

  &lt;div style="position: relative; top: -36px; left: 130px"&gt;&lt;strong&gt;&lt;a href="http://www.galasoft.ch/contact_en.html"&gt;Laurent Bugnion (GalaSoft)&lt;/a&gt;&lt;/strong&gt; 

    &lt;br /&gt;&lt;a href="http://feeds.feedburner.com/galasoft"&gt;Subscribe&lt;/a&gt; | &lt;a href="http://twitter.com/lbugnion"&gt;Twitter&lt;/a&gt; | &lt;a href="http://www.facebook.com/lbugnion"&gt;Facebook&lt;/a&gt; | &lt;a href="http://www.flickr.com/photos/lbugnion"&gt;Flickr&lt;/a&gt; | &lt;a href="http://www.linkedin.com/in/lbugnion"&gt;LinkedIn&lt;/a&gt; 

    &lt;br /&gt;&lt;iframe style="border-bottom-style: none; margin-top: 7px; border-left-style: none; width: 450px; border-top-style: none; margin-bottom: -20px; height: 23px; border-right-style: none; overflow: hidden" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.galasoft.ch/archive/2011/12/07/mvvm-light-template-and-wcf-services-or-any-asp.net-application.aspx&amp;amp;layout=standard&amp;amp;show_faces=true&amp;amp;width=450&amp;amp;action=like&amp;amp;colorscheme=light" frameborder="0" allowtransparency="allowtransparency" scrolling="no"&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;/div&gt; &lt;img src="http://blog.galasoft.ch/aggbug/147973.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Laurent Bugnion</dc:creator>
            <guid>http://blog.galasoft.ch/archive/2011/12/07/mvvm-light-template-and-wcf-services-or-any-asp.net-application.aspx</guid>
            <pubDate>Wed, 07 Dec 2011 21:36:33 GMT</pubDate>
            <wfw:comment>http://blog.galasoft.ch/comments/147973.aspx</wfw:comment>
            <comments>http://blog.galasoft.ch/archive/2011/12/07/mvvm-light-template-and-wcf-services-or-any-asp.net-application.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://blog.galasoft.ch/comments/commentRss/147973.aspx</wfw:commentRss>
            <trackback:ping>http://blog.galasoft.ch/services/trackbacks/147973.aspx</trackback:ping>
        </item>
        <item>
            <title>MVVM Light Toolkit for Windows 8 (preview) #mvvmlight #win8</title>
            <link>http://blog.galasoft.ch/archive/2011/10/03/mvvm-light-toolkit-for-windows-8-preview-mvvmlight-win8.aspx</link>
            <description>&lt;p&gt;I was very optimistic when I first saw Metro style apps coded in C# on Windows 8, because for the most part they are not much different than the well known XAML/C# pair on Silverlight or WPF. This led me to brag a bit about probably having a port of MVVM Light ready “in a few days”. Of course I didn’t take in account that I would have a great time the week after //build in Seattle, with fantastic weather and tons of friends to have dinner and conversations with. Needless to say, the few days turned out, in fact, to be a couple of weeks.&lt;/p&gt;  &lt;p&gt;Nonetheless, I am proud and happy to announce the availability of MVVM Light Toolkit for Windows 8. Let’s be clear, this is a preview version. All the unit tests are green for the selected components (there are a couple of components not ported yet, see the section below titled “Missing components”). However, a green unit test does not quite mean that the tested component is completely safe to use, so please be careful with that material and &lt;a href="mailto:laurent@galasoft.ch"&gt;send me your feedback if you find issues&lt;/a&gt;.&lt;/p&gt;  &lt;h2&gt;Installation&lt;/h2&gt;  &lt;p&gt;MVVM Light for Windows 8 is a side-by-side install with the standard MVVM Light V3 or V4 beta. Simply &lt;a href="http://mvvmlight.codeplex.com/releases/view/74325"&gt;download and run the MSI from Codeplex&lt;/a&gt;. As usual, the last step of the installation performs a “/setup” of Visual Studio to actualize the project template cache, and unfortunately this last step can last very long. Please be patient and don’t cancel before the end! The installation process is very similar to that described on the &lt;a href="http://www.galasoft.ch/mvvm/installing"&gt;MVVM Light installation page&lt;/a&gt; (except that there is no NuGet installer for VS11 yet).&lt;/p&gt;  &lt;p&gt;&lt;img src="http://farm7.static.flickr.com/6168/6207048445_7128fe2beb_o_d.png" /&gt;&lt;/p&gt;  &lt;p&gt;Note however that if you uninstall MVVM Light V3/V4b, but still want to keep MVVM Light for Win8, you may have to repair MVVM Light for Win8. Simply run the installer again and select “Repair”.&lt;/p&gt;  &lt;h2&gt;Ported components&lt;/h2&gt;  &lt;p&gt;Almost all MVVM Light components are also available in the Windows 8 version. The ported components are:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;ObservableObject&lt;/strong&gt; including all ways to raise PropertyChanged. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;ViewModelBase&lt;/strong&gt; including all ways to raise PropertyChanged. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Messenger&lt;/strong&gt; including all message types except DialogMessage (see below). &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;RelayCommand&lt;/strong&gt; with and without parameter. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;SimpleIoc&lt;/strong&gt; which might well be the very first IOC container working on Windows 8. &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;&lt;/h3&gt;  &lt;h3&gt;File, New Project&lt;/h3&gt;  &lt;p&gt;I also created a Metro style version of the MVVM Light project template. To create a new MVVM Light-powered Metro Style application, follow the steps:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Select the menu File, New, Project. &lt;/li&gt;    &lt;li&gt;In the New Project dialog, select the category Visual C# / Wndows Metro style and double click the MvvmLight (Win8) template. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img src="http://farm7.static.flickr.com/6164/6207665952_cc8b895362_b_d.jpg" width="560" height="383" /&gt;&lt;/p&gt;  &lt;p&gt;The created application is a very simple MVVM application, very similar to the ones that get created in Silverlight, WPF or Windows Phone 7: it contains a model with IDataService, a dummy runtime implementation and a design time implementation. The ViewModelLocator is available and “wired” (using the SimpleIoc container) as well as a MainViewModel that is set as DataContext on the MainPage.&lt;/p&gt;  &lt;h2&gt;Missing components&lt;/h2&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;Skins&lt;/strong&gt;: There is a small change in the way that resource dictionaries are handled in Windows 8. I need to sort things out, so right now there is no “MainSkin.xaml” in the project template. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;DialogMessage&lt;/strong&gt;: This type is bugging me in V3/V4b because it is bringing the MessageBoxResult type into the ViewModel. I am looking at ways to make it better by converting the MessageBoxResult into a vanilla Boolean. In Windows 8, MessageBoxResult does not exist anymore (there is no MessageBox or popups of any kinds in Metro style apps). Consequently, the DialogMessage does not build, and I decided to just remove it for now. I will add it again when I refactor to the “vanilla” version. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;EventToCommand&lt;/strong&gt;: There are no Blend behaviors in Windows 8 yet (important word: &lt;strong&gt;yet&lt;/strong&gt;). I am looking at ways to have behaviors on Windows 8 before Blend 5 for XAML gets released. Stay tuned. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;DispatcherHelper&lt;/strong&gt;: The Dispatcher object has changed quite a lot in Windows 8, and I am looking at ways to keep the DispatcherHelper compatible with previous versions of MVVM Light by wrapping these differences. It shouldn’t be a big deal, but I want to give myself a little time to get it right (hopefully). &lt;/li&gt; &lt;/ul&gt;  &lt;h2&gt;Next steps&lt;/h2&gt;  &lt;p&gt;I intend to build a small sample application (very similar to the one I built for my MIX11 talk) to try the various components in real life conditions. This will of course be the topic of an upcoming blog post.&lt;/p&gt;  &lt;p&gt;I encourage everyone to try these components in Windows 8 preview, and please don’t be shy with your feedback!&lt;/p&gt;  &lt;p&gt;Cheers,    &lt;br /&gt;Laurent&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;div style="margin-bottom: -1em"&gt;   &lt;div style="vertical-align: middle"&gt;&lt;a href="http://www.galasoft.ch/"&gt;&lt;img title="GalaSoft Laurent Bugnion" alt="GalaSoft Laurent Bugnion" src="http://www.galasoft.ch/logo/Current/logo_120x30.png" /&gt;&lt;/a&gt; &lt;/div&gt;    &lt;div style="position: relative; left: 130px; top: -36px"&gt;&lt;strong&gt;&lt;a href="http://www.galasoft.ch/contact_en.html"&gt;Laurent Bugnion (GalaSoft)&lt;/a&gt;&lt;/strong&gt;       &lt;br /&gt;&lt;a href="http://feeds.feedburner.com/galasoft"&gt;Subscribe&lt;/a&gt; | &lt;a href="http://twitter.com/lbugnion"&gt;Twitter&lt;/a&gt; | &lt;a href="http://www.facebook.com/lbugnion"&gt;Facebook&lt;/a&gt; | &lt;a href="http://www.flickr.com/photos/lbugnion"&gt;Flickr&lt;/a&gt; | &lt;a href="http://www.linkedin.com/in/lbugnion"&gt;LinkedIn&lt;/a&gt;       &lt;br /&gt;&lt;iframe style="border-top-style: none; margin-bottom: -20px; height: 23px; width: 450px; border-bottom-style: none; overflow: hidden; border-right-style: none; border-left-style: none; margin-top: 7px" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.galasoft.ch/archive/2011/10/03/mvvm-light-toolkit-for-windows-8-preview-mvvmlight-win8.aspx&amp;amp;layout=standard&amp;amp;show_faces=true&amp;amp;width=450&amp;amp;action=like&amp;amp;colorscheme=light" frameborder="0" allowtransparency="allowtransparency" scrolling="no"&gt;&lt;/iframe&gt;&lt;/div&gt; &lt;/div&gt; &lt;img src="http://blog.galasoft.ch/aggbug/147166.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Laurent Bugnion</dc:creator>
            <guid>http://blog.galasoft.ch/archive/2011/10/03/mvvm-light-toolkit-for-windows-8-preview-mvvmlight-win8.aspx</guid>
            <pubDate>Mon, 03 Oct 2011 19:28:19 GMT</pubDate>
            <wfw:comment>http://blog.galasoft.ch/comments/147166.aspx</wfw:comment>
            <comments>http://blog.galasoft.ch/archive/2011/10/03/mvvm-light-toolkit-for-windows-8-preview-mvvmlight-win8.aspx#feedback</comments>
            <slash:comments>4</slash:comments>
            <wfw:commentRss>http://blog.galasoft.ch/comments/commentRss/147166.aspx</wfw:commentRss>
            <trackback:ping>http://blog.galasoft.ch/services/trackbacks/147166.aspx</trackback:ping>
        </item>
        <item>
            <title>Breaking change: Raising PropertyChanged with string.Empty in WinRT / Windows 8</title>
            <link>http://blog.galasoft.ch/archive/2011/09/25/breaking-change-raising-propertychanged-with-string.empty-in-winrt--windows.aspx</link>
            <description>&lt;p&gt;In the developer preview of Windows 8, I just noticed a breaking change in the way that data bindings react to the &lt;strong&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.data.inotifypropertychanged.propertychanged(v=VS.85).aspx"&gt;PropertyChanged&lt;/a&gt;&lt;/strong&gt; event.&lt;/p&gt;  &lt;p&gt;First a bit of background: Often, objects that are databound to the UI are simple data objects (also called ViewModels) that implement the &lt;strong&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.data.inotifypropertychanged(v=VS.85).aspx"&gt;INotifyPropertyChanged&lt;/a&gt;&lt;/strong&gt; interface. This interface is very simple and defines just one event, the PropertyChanged event, that needs to be raised by the ViewModel when one of its property changes. It is what makes the ViewModel “observable”. If a property of another object (typically a UI element) is data bound (through a Binding object, often set declaratively in XAML), then the value of the observing property will be synchronized to the value of the observable property.&lt;/p&gt;  &lt;p&gt;Raising the PropertyChanged event requires an instance of the &lt;strong&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.data.propertychangedeventargs(v=VS.85).aspx"&gt;PropertyChangedEventArgs&lt;/a&gt;&lt;/strong&gt; class, which takes a string as sole parameter of its constructor. The string to be passed is the name of the observable property.&lt;/p&gt;  &lt;h2&gt;Raising with string.Empty or null&lt;/h2&gt;  &lt;p&gt;In WPF and Silverlight, it is possible to raise the PropertyChanged event with an instance of the PropertyChangedEventArgs class constructed with string.Empty (or null) instead of an existing property’s name. When a PropertyChanged event is raised in this manner, the UI will re-query the value of each property of the ViewModel that is data bound to the UI. This is a convenient way to raise but one event and force the UI to update itself in response to cascading changes, for example. As such, this can be a good way to increase the performance of the application.&lt;/p&gt;  &lt;h2&gt;The breaking change in WinRT&lt;/h2&gt;  &lt;p&gt;However, while unit testing the version of &lt;a href="http://www.galasoft.ch/mvvm"&gt;MVVM Light&lt;/a&gt; for WinRT, I found out that raising the PropertyChanged event with an empty string or null does not update the bindings. I quickly coded a repro, and then coded the exact same code in Silverlight, and indeed the two applications do not react the same at all.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://galasoft.ch/blogs-all/Resources/20110925/INPCBreakingWinRT.zip"&gt;Metro – style repro&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://galasoft.ch/blogs-all/Resources/20110925/INPCBreakingSilverlight.zip"&gt;Expected behavior in Silverlight for comparison&lt;/a&gt;.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Hopefully this is only an oversight and this will be fixed in a future version. &lt;/p&gt;  &lt;p&gt;Cheers,   &lt;br /&gt;Laurent&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;div style="margin-bottom: -1em"&gt;   &lt;div style="vertical-align: middle"&gt;&lt;a href="http://www.galasoft.ch/"&gt;&lt;img title="GalaSoft Laurent Bugnion" alt="GalaSoft Laurent Bugnion" src="http://www.galasoft.ch/logo/Current/logo_120x30.png" /&gt;&lt;/a&gt; &lt;/div&gt;    &lt;div style="position: relative; left: 130px; top: -36px"&gt;&lt;strong&gt;&lt;a href="http://www.galasoft.ch/contact_en.html"&gt;Laurent Bugnion (GalaSoft)&lt;/a&gt;&lt;/strong&gt;       &lt;br /&gt;&lt;a href="http://feeds.feedburner.com/galasoft"&gt;Subscribe&lt;/a&gt; | &lt;a href="http://twitter.com/lbugnion"&gt;Twitter&lt;/a&gt; | &lt;a href="http://www.facebook.com/lbugnion"&gt;Facebook&lt;/a&gt; | &lt;a href="http://www.flickr.com/photos/lbugnion"&gt;Flickr&lt;/a&gt; | &lt;a href="http://www.linkedin.com/in/lbugnion"&gt;LinkedIn&lt;/a&gt;       &lt;br /&gt;&lt;iframe style="border-top-style: none; margin-bottom: -20px; height: 23px; width: 450px; border-bottom-style: none; overflow: hidden; border-right-style: none; border-left-style: none; margin-top: 7px" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.galasoft.ch/archive/2011/09/25/breaking-change-raising-propertychanged-with-string.empty-in-winrt--windows.aspx&amp;amp;layout=standard&amp;amp;show_faces=true&amp;amp;width=450&amp;amp;action=like&amp;amp;colorscheme=light" frameborder="0" allowtransparency="allowtransparency" scrolling="no"&gt;&lt;/iframe&gt;&lt;/div&gt; &lt;/div&gt; &lt;img src="http://blog.galasoft.ch/aggbug/147041.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Laurent Bugnion</dc:creator>
            <guid>http://blog.galasoft.ch/archive/2011/09/25/breaking-change-raising-propertychanged-with-string.empty-in-winrt--windows.aspx</guid>
            <pubDate>Sun, 25 Sep 2011 21:57:41 GMT</pubDate>
            <wfw:comment>http://blog.galasoft.ch/comments/147041.aspx</wfw:comment>
            <comments>http://blog.galasoft.ch/archive/2011/09/25/breaking-change-raising-propertychanged-with-string.empty-in-winrt--windows.aspx#feedback</comments>
            <slash:comments>4</slash:comments>
            <wfw:commentRss>http://blog.galasoft.ch/comments/commentRss/147041.aspx</wfw:commentRss>
            <trackback:ping>http://blog.galasoft.ch/services/trackbacks/147041.aspx</trackback:ping>
        </item>
        <item>
            <title>Quick tip: Select the correct INotifyPropertyChanged in Windows 8 / WinRT</title>
            <link>http://blog.galasoft.ch/archive/2011/09/25/quick-tip-select-the-correct-inotifypropertychanged-in-windows-8.aspx</link>
            <description>&lt;p&gt;Microsoft loves MVVM and INotifyPropertyChanged so much that they included this very useful interface twice in the new WinRT framework. Unfortunately, only one of these is working correctly (and the other one is likely a bug, remnant from the past &lt;img class="wlEmoticon wlEmoticon-winkingsmile" style="border-top-style: none; border-bottom-style: none; border-right-style: none; border-left-style: none" alt="Winking smile" src="http://geekswithblogs.net/images/geekswithblogs_net/lbugnion/Windows-Live-Writer/Quick-tip-Select-the-correct-INotifyProp_1400B/wlEmoticon-winkingsmile_2.png" /&gt;)&lt;/p&gt;  &lt;p&gt;When implementing INotifyPropertyChanged, make sure that you select the correct one! The one you want to use is into &lt;strong&gt;Windows.UI.Xaml.Data&lt;/strong&gt;. The old one, the one you DON’T WANT is into System.ComponentModel (the same namespace it was in WPF and Silverlight). If you select the wrong one, the Bindings will not be updated and the UI will remain dead as a dead fish. &lt;/p&gt;  &lt;p&gt;&lt;img src="http://farm7.static.flickr.com/6173/6182240057_d008054937_o_d.png" /&gt;&lt;/p&gt;  &lt;p&gt;I mentioned before that Microsoft took the “once in a lifetime” opportunity (well, 5-10 years is a lifetime in the world of computers) to clean up and rearrange classes within the framework. This is one of the signs right here. As for the System.ComponentModel.INotifyPropertyChanged, I guess it will be removed in a later release of the WinRT framework.&lt;/p&gt;  &lt;div class="frame"&gt;&lt;strong&gt;Update&lt;/strong&gt;: Indeed I was just told by the excellent and always vigilant Tim Heuer &lt;a href="https://twitter.com/#!/timheuer/status/118075660366385152"&gt;that this bug has already been fixed&lt;/a&gt;. I guess we will see the fix in the next release to developers of Windows 8.&lt;/div&gt;  &lt;p&gt;Cheers,&lt;/p&gt;  &lt;p&gt;Laurent&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;div style="margin-bottom: -1em"&gt;   &lt;div style="vertical-align: middle"&gt;&lt;a href="http://www.galasoft.ch/"&gt;&lt;img title="GalaSoft Laurent Bugnion" alt="GalaSoft Laurent Bugnion" src="http://www.galasoft.ch/logo/Current/logo_120x30.png" /&gt;&lt;/a&gt; &lt;/div&gt;    &lt;div style="position: relative; left: 130px; top: -36px"&gt;&lt;strong&gt;&lt;a href="http://www.galasoft.ch/contact_en.html"&gt;Laurent Bugnion (GalaSoft)&lt;/a&gt;&lt;/strong&gt;       &lt;br /&gt;&lt;a href="http://feeds.feedburner.com/galasoft"&gt;Subscribe&lt;/a&gt; | &lt;a href="http://twitter.com/lbugnion"&gt;Twitter&lt;/a&gt; | &lt;a href="http://www.facebook.com/lbugnion"&gt;Facebook&lt;/a&gt; | &lt;a href="http://www.flickr.com/photos/lbugnion"&gt;Flickr&lt;/a&gt; | &lt;a href="http://www.linkedin.com/in/lbugnion"&gt;LinkedIn&lt;/a&gt;       &lt;br /&gt;&lt;iframe style="border-top-style: none; margin-bottom: -20px; height: 23px; width: 450px; border-bottom-style: none; overflow: hidden; border-right-style: none; border-left-style: none; margin-top: 7px" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.galasoft.ch/archive/2011/09/25/quick-tip-select-the-correct-inotifypropertychanged-in-windows-8.aspx&amp;amp;layout=standard&amp;amp;show_faces=true&amp;amp;width=450&amp;amp;action=like&amp;amp;colorscheme=light" frameborder="0" allowtransparency="allowtransparency" scrolling="no"&gt;&lt;/iframe&gt;&lt;/div&gt; &lt;/div&gt; &lt;img src="http://blog.galasoft.ch/aggbug/147038.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Laurent Bugnion</dc:creator>
            <guid>http://blog.galasoft.ch/archive/2011/09/25/quick-tip-select-the-correct-inotifypropertychanged-in-windows-8.aspx</guid>
            <pubDate>Sun, 25 Sep 2011 20:47:24 GMT</pubDate>
            <wfw:comment>http://blog.galasoft.ch/comments/147038.aspx</wfw:comment>
            <comments>http://blog.galasoft.ch/archive/2011/09/25/quick-tip-select-the-correct-inotifypropertychanged-in-windows-8.aspx#feedback</comments>
            <slash:comments>9</slash:comments>
            <wfw:commentRss>http://blog.galasoft.ch/comments/commentRss/147038.aspx</wfw:commentRss>
            <trackback:ping>http://blog.galasoft.ch/services/trackbacks/147038.aspx</trackback:ping>
        </item>
        <item>
            <title>Detecting design mode in Windows 8/WinRT</title>
            <link>http://blog.galasoft.ch/archive/2011/09/25/detecting-design-mode-in-windows-8winrt.aspx</link>
            <description>&lt;p&gt;One of the very useful features of the &lt;a href="http://www.galasoft.ch/mvvm"&gt;MVVM Light toolkit&lt;/a&gt; is to help with the creation of design time data, in order to give something to see on the design surface (Expression Blend, Visual Studio designer). This is especially useful when designing list controls such as ListBox, ComboBox, etc. Without design time data, these controls will remain empty, and the designer will not see what he is working on. This can cost a lot of time and cause frustration.&lt;/p&gt;  &lt;p&gt;Detecting design mode was always incompatible in WPF and in Silverlight.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;In WPF, we use a rather complicated snippet: &lt;/li&gt; &lt;/ul&gt;  &lt;pre class="csharp" name="code"&gt;var prop = DesignerProperties.IsInDesignModeProperty;
_isInDesignMode
    = (bool)DependencyPropertyDescriptor
                 .FromProperty(prop, typeof(FrameworkElement))
                 .Metadata.DefaultValue;&lt;/pre&gt;

&lt;ul&gt;
  &lt;li&gt;In Silverlight, there is a convenient property: &lt;/li&gt;
&lt;/ul&gt;

&lt;pre class="csharp" name="code"&gt;_isInDesignMode = DesignerProperties.IsInDesignTool;&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;In WinRT, &lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.designmode.designmodeenabled(v=VS.85).aspx"&gt;we have to use yet another property&lt;/a&gt;: &lt;/li&gt;
&lt;/ul&gt;

&lt;pre class="csharp" name="code"&gt;_isInDesignMode 
    = Windows.ApplicationModel.DesignMode.DesignModeEnabled;&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;

&lt;h2&gt;Abstracting the differences&lt;/h2&gt;

&lt;p&gt;These differences can make it difficult to share code between these environments. This is why the MVVM Light toolkit abstracts these and provides a convenient property on the ViewModelBase class:&lt;/p&gt;

&lt;pre class="csharp" name="code"&gt;(within a ViewModel deriving from ViewModelBase):

if (IsInDesignMode)
{
    // Create design time data
}
else
{
    // Create run time data
}

(within any class not deriving from ViewModelBase):

if (ViewModelBase.IsInDesignModeStatic)
{
    // Create design time data
}
else
{
    // Create run time data
}&lt;/pre&gt;

&lt;p&gt;Happy coding!&lt;/p&gt;

&lt;p&gt;Laurent&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;div style="margin-bottom: -1em"&gt;
  &lt;div style="vertical-align: middle"&gt;&lt;a href="http://www.galasoft.ch/"&gt;&lt;img title="GalaSoft Laurent Bugnion" alt="GalaSoft Laurent Bugnion" src="http://www.galasoft.ch/logo/Current/logo_120x30.png" /&gt;&lt;/a&gt; &lt;/div&gt;

  &lt;div style="position: relative; left: 130px; top: -36px"&gt;&lt;strong&gt;&lt;a href="http://www.galasoft.ch/contact_en.html"&gt;Laurent Bugnion (GalaSoft)&lt;/a&gt;&lt;/strong&gt; 

    &lt;br /&gt;&lt;a href="http://feeds.feedburner.com/galasoft"&gt;Subscribe&lt;/a&gt; | &lt;a href="http://twitter.com/lbugnion"&gt;Twitter&lt;/a&gt; | &lt;a href="http://www.facebook.com/lbugnion"&gt;Facebook&lt;/a&gt; | &lt;a href="http://www.flickr.com/photos/lbugnion"&gt;Flickr&lt;/a&gt; | &lt;a href="http://www.linkedin.com/in/lbugnion"&gt;LinkedIn&lt;/a&gt; 

    &lt;br /&gt;&lt;iframe style="border-top-style: none; margin-bottom: -20px; height: 23px; width: 450px; border-bottom-style: none; overflow: hidden; border-right-style: none; border-left-style: none; margin-top: 7px" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.galasoft.ch/archive/2011/09/25/detecting-design-mode-in-windows-8winrt.aspx&amp;amp;layout=standard&amp;amp;show_faces=true&amp;amp;width=450&amp;amp;action=like&amp;amp;colorscheme=light" frameborder="0" allowtransparency="allowtransparency" scrolling="no"&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;/div&gt; &lt;img src="http://blog.galasoft.ch/aggbug/147036.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Laurent Bugnion</dc:creator>
            <guid>http://blog.galasoft.ch/archive/2011/09/25/detecting-design-mode-in-windows-8winrt.aspx</guid>
            <pubDate>Sun, 25 Sep 2011 19:02:59 GMT</pubDate>
            <wfw:comment>http://blog.galasoft.ch/comments/147036.aspx</wfw:comment>
            <comments>http://blog.galasoft.ch/archive/2011/09/25/detecting-design-mode-in-windows-8winrt.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://blog.galasoft.ch/comments/commentRss/147036.aspx</wfw:commentRss>
            <trackback:ping>http://blog.galasoft.ch/services/trackbacks/147036.aspx</trackback:ping>
        </item>
        <item>
            <title>Dealing with types in WinRT</title>
            <link>http://blog.galasoft.ch/archive/2011/09/25/dealing-with-types-in-winrt.aspx</link>
            <description>&lt;p&gt;Another quick tip: Most of the interaction with the System.Type class in Windows 8 is now done through the &lt;strong&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/system.reflection.typeinfo(v=VS.110).aspx"&gt;TypeInfo&lt;/a&gt;&lt;/strong&gt; class. An instance of TypeInfo for a give type is retrieved using an extension method called &lt;strong&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/system.reflection.introspectionextensions.gettypeinfo(v=VS.110).aspx"&gt;GetTypeInfo()&lt;/a&gt;&lt;/strong&gt;. Note that since &lt;strong&gt;this is an extension method&lt;/strong&gt;, it will not be visible in Intellisense unless you add a reference to &lt;strong&gt;System.Reflection&lt;/strong&gt; in the “using” section:&lt;/p&gt;  &lt;pre class="csharp" name="code"&gt;// Needed for the extension method
using System.Reflection;

(...)

var info = myType.GetTypeInfo();

// Was: string name = myType.Name
string name = info.Name;

// Was: Type[] interfaces = myType.GetInterfaces();
IEnumerable&amp;lt;Type&amp;gt; interfaces = info.ImplementedInterfaces;

// Was: bool check = myType.IsSubclassOf(anotherType);
bool check = anotherType.GetTypeInfo().IsAssignableFrom(info);

(etc...)&lt;/pre&gt;

&lt;p&gt;&lt;em&gt;Note: IsSubclassOf and IsAssignableFrom do not have the exact same meaning, however in many cases it should be able to use &lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/system.type.isassignablefrom(v=VS.110).aspx"&gt;IsAssignableFrom&lt;/a&gt;. Make sure to &lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/system.type.isassignablefrom(v=VS.110).aspx"&gt;check the documentation&lt;/a&gt; to verify that this is indeed what you want!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Hopefully this is useful to WinRT coders out there!&lt;/p&gt;

&lt;p&gt;Laurent&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;div style="margin-bottom: -1em"&gt;
  &lt;div style="vertical-align: middle"&gt;&lt;a href="http://www.galasoft.ch/"&gt;&lt;img title="GalaSoft Laurent Bugnion" alt="GalaSoft Laurent Bugnion" src="http://www.galasoft.ch/logo/Current/logo_120x30.png" /&gt;&lt;/a&gt; &lt;/div&gt;

  &lt;div style="position: relative; left: 130px; top: -36px"&gt;&lt;strong&gt;&lt;a href="http://www.galasoft.ch/contact_en.html"&gt;Laurent Bugnion (GalaSoft)&lt;/a&gt;&lt;/strong&gt; 

    &lt;br /&gt;&lt;a href="http://feeds.feedburner.com/galasoft"&gt;Subscribe&lt;/a&gt; | &lt;a href="http://twitter.com/lbugnion"&gt;Twitter&lt;/a&gt; | &lt;a href="http://www.facebook.com/lbugnion"&gt;Facebook&lt;/a&gt; | &lt;a href="http://www.flickr.com/photos/lbugnion"&gt;Flickr&lt;/a&gt; | &lt;a href="http://www.linkedin.com/in/lbugnion"&gt;LinkedIn&lt;/a&gt; 

    &lt;br /&gt;&lt;iframe style="border-top-style: none; margin-bottom: -20px; height: 23px; width: 450px; border-bottom-style: none; overflow: hidden; border-right-style: none; border-left-style: none; margin-top: 7px" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.galasoft.ch/archive/2011/09/25/dealing-with-types-in-winrt.aspx&amp;amp;layout=standard&amp;amp;show_faces=true&amp;amp;width=450&amp;amp;action=like&amp;amp;colorscheme=light" frameborder="0" allowtransparency="allowtransparency" scrolling="no"&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;/div&gt; &lt;img src="http://blog.galasoft.ch/aggbug/147035.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Laurent Bugnion</dc:creator>
            <guid>http://blog.galasoft.ch/archive/2011/09/25/dealing-with-types-in-winrt.aspx</guid>
            <pubDate>Sun, 25 Sep 2011 18:35:54 GMT</pubDate>
            <wfw:comment>http://blog.galasoft.ch/comments/147035.aspx</wfw:comment>
            <comments>http://blog.galasoft.ch/archive/2011/09/25/dealing-with-types-in-winrt.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://blog.galasoft.ch/comments/commentRss/147035.aspx</wfw:commentRss>
            <trackback:ping>http://blog.galasoft.ch/services/trackbacks/147035.aspx</trackback:ping>
        </item>
        <item>
            <title>Running unit tests in Visual Studio 2011 and Windows 8 (WinRT)</title>
            <link>http://blog.galasoft.ch/archive/2011/09/24/running-unit-tests-in-visual-studio-2011-and-windows-8.aspx</link>
            <description>&lt;p&gt;This is a quick tip, because it confused me at first. But thanks to the always excellent Tim Heuer and Peter Provost (from the Visual Studio team), here is the answer:&lt;/p&gt;  &lt;p&gt;&lt;em&gt;Usual disclaimer: This is for XAML/C#. I am not sure how this works for the other programming stacks.&lt;/em&gt;&lt;/p&gt;  &lt;h2&gt;Creating unit tests for your WinRT application/library&lt;/h2&gt;  &lt;ul&gt;   &lt;li&gt;Start Visual Studio 2011. &lt;/li&gt;    &lt;li&gt;Create a new project. &lt;/li&gt;    &lt;li&gt;From the Add New Project dialog, select Unit Test Library (In the Visual C#/Windows Metro Style category). Give a name to the project and press OK. &lt;/li&gt;    &lt;li&gt;Either open the unit test class that was created, or create a new class. No need to select a fancy template, just create a new empty class. &lt;/li&gt;    &lt;li&gt;Decorate the class with a [TestClass] attribute. &lt;/li&gt;    &lt;li&gt;Create a public method with no parameters, and decorate it with a [TestMethod] attribute. &lt;/li&gt;    &lt;li&gt;Right click on the unit test project and select Add Reference from the context menu. &lt;/li&gt;    &lt;li&gt;In the Reference Manager, select Solution and then the project you want to write tests for. Then press Add and then Close. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;You can now write your tests, using the usual Assert syntax. Here is a simple example.&lt;/p&gt;  &lt;pre class="csharp" name="code"&gt;[TestClass]
public class UnitTest1
{
    [TestMethod]        
    public void TestAlwaysPass()
    {
        const string expected = "Any text";
        var myClass = new ClassLibrary1.Class1(expected);

        Assert.AreEqual(expected, myClass.Parameter);
    }

    [TestMethod]
    public void TestAlwaysFail()
    {
        const string expected = "Any text";
        var myClass = new ClassLibrary1.Class1(expected);

        const string notExpected = "Another text";
        Assert.AreEqual(notExpected, myClass.Parameter);
    }
}&lt;/pre&gt;

&lt;h2&gt;Running the unit tests &lt;/h2&gt;

&lt;p&gt;To run the unit tests you just wrote, follow the steps:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Select the menu View / Other Windows / Unit Test Explorer. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src="http://farm7.static.flickr.com/6154/6176518106_f9931302b5_b_d.jpg" /&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Build your application. You should now see the unit tests you wrote in the explorer window. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src="http://farm7.static.flickr.com/6177/6175989313_920efb0a95_o_d.png" /&gt; &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Press Run All to run all the unit tests. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src="http://farm7.static.flickr.com/6164/6176518256_792976cb69_o_d.png" /&gt;&lt;/p&gt;

&lt;p&gt;Hopefully this quick tip will be helpful!&lt;/p&gt;

&lt;p&gt;Cheers&lt;/p&gt;

&lt;p&gt;Laurent&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;div style="margin-bottom: -1em"&gt;
  &lt;div style="vertical-align: middle"&gt;&lt;a href="http://www.galasoft.ch/"&gt;&lt;img title="GalaSoft Laurent Bugnion" alt="GalaSoft Laurent Bugnion" src="http://www.galasoft.ch/logo/Current/logo_120x30.png" /&gt;&lt;/a&gt; &lt;/div&gt;

  &lt;div style="position: relative; left: 130px; top: -36px"&gt;&lt;strong&gt;&lt;a href="http://www.galasoft.ch/contact_en.html"&gt;Laurent Bugnion (GalaSoft)&lt;/a&gt;&lt;/strong&gt; 

    &lt;br /&gt;&lt;a href="http://feeds.feedburner.com/galasoft"&gt;Subscribe&lt;/a&gt; | &lt;a href="http://twitter.com/lbugnion"&gt;Twitter&lt;/a&gt; | &lt;a href="http://www.facebook.com/lbugnion"&gt;Facebook&lt;/a&gt; | &lt;a href="http://www.flickr.com/photos/lbugnion"&gt;Flickr&lt;/a&gt; | &lt;a href="http://www.linkedin.com/in/lbugnion"&gt;LinkedIn&lt;/a&gt; 

    &lt;br /&gt;&lt;iframe style="border-top-style: none; margin-bottom: -20px; height: 23px; width: 450px; border-bottom-style: none; overflow: hidden; border-right-style: none; border-left-style: none; margin-top: 7px" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.galasoft.ch/archive/2011/09/24/running-unit-tests-in-visual-studio-2011-and-windows-8.aspx&amp;amp;layout=standard&amp;amp;show_faces=true&amp;amp;width=450&amp;amp;action=like&amp;amp;colorscheme=light" frameborder="0" allowtransparency="allowtransparency" scrolling="no"&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;/div&gt; &lt;img src="http://blog.galasoft.ch/aggbug/147020.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Laurent Bugnion</dc:creator>
            <guid>http://blog.galasoft.ch/archive/2011/09/24/running-unit-tests-in-visual-studio-2011-and-windows-8.aspx</guid>
            <pubDate>Fri, 23 Sep 2011 22:50:42 GMT</pubDate>
            <wfw:comment>http://blog.galasoft.ch/comments/147020.aspx</wfw:comment>
            <comments>http://blog.galasoft.ch/archive/2011/09/24/running-unit-tests-in-visual-studio-2011-and-windows-8.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://blog.galasoft.ch/comments/commentRss/147020.aspx</wfw:commentRss>
            <trackback:ping>http://blog.galasoft.ch/services/trackbacks/147020.aspx</trackback:ping>
        </item>
    </channel>
</rss>
