Tore Aurstad

Tore Aurstad Thundar Viking

Niner since 2010

Computer Engineer from NTNU (Master of Technology)  Mr. Tore Aurstad


  • Silverlight TV 79: Data Binding Debugging

    Is it not possible to set a breakpoint in the binding statements of the XAML code for a WPF application? There is a lot of complex scenarios where this would be helpful. I usually use Snoop or look at the Output window to understand why data binding fails in my LOB apps....

  • Code Analysis Using Visual Studio 2010

    Very nice introduction to code analysis. It would be nice with more examples of how to break and fix code analysis rules in Visual Studio.

  • WPF Design Surface Improvements in Visual Studio 2010

    I use MVVM pattern when developing WPF now. The feature of setting datacontext in XAML so that Intellisense is provided was an unknown functionality for me. This makes it easier to set up bindings to the view model in the binding expressions of the XAML.

    Nice shirts by the way, but where is the drinks with the umbrellas Smiley ?

  • MEF & Silverlight 4 Beta - Part 1, Introduction

    Very fun to observe how MEF uses its automatic "type inference magic" to discover classes exporting themselves or interfaces. The way one could implement a pluggable, extensible environment for an application seems like a clear path for me. Are there hidden challenges along the way, i.e. if one would implement an application with several plugins perhaps using [ImportMany] of a given interface, it all looks very tempting to follow that tracks, but are there some things one should avoid while going down that path or is MEF just plain simple, elegant and wonderful ? (rhetoric there at the end Big Smile )

  • MEF & Silverlight 4 Beta - Part 4, ​Recompositi​on

    A very good video and good basic example on adding typecatalogs and the automatic discovery by MEF of classes implementing requested interfaces through export-import functionality of MEF. The video explains how to apply [Import(AllowRecomposition=true)]

    or [ImportMany(AllowRecomposition=true)] - the AllowRecomposition setting of an import to specify that an import might change during execution time and making it possible to satisfy an import at a later stage when the program is running.


    I followed along the video in Visual Studio ("coding along") and everything in this video worked great on my setup also. Another pedagogical masterpiece of Mike Taulty explaining the wonders of MEF.


    -= The somewhat civilized barbarian =-  

  • MEF & Silverlight 4 Beta - Part 2, Imports & Exports

    I just followed the entire video and coded along. It works great, but there was one bit I couldn't implement. The PartCreator class was not found on my machine, I am using the latest, official version of MEF that is shipped together with Visual Studio 2010.

    By the way, this video demonstrates some more advanced concepts in MEF like lazy initializations and custom export attribute. I found the video to be a good learning experience and the narrator has a good way of communicating difificult concepts in a clear and concise manner.

  • MEF & Silverlight 4 Beta - Part 1, Introduction

    I just followed the example that Mike Taulty demonstrates in this video. The example works great, besides one little code line that seems to have to be changed to make it work, at least that is what I experienced:



    With: CompositionInitializer.SatisfyImports(this);



    The class resides in System.ComponentModel.Composition and the line goes into the place where the PartInitializer is being used (constructor of MainPage).


    -= The somewhat civilized Barbarian =-

  • MEF & Silverlight 4 Beta - Part 3, Catalogs

    The code in this video is mostly working but the last part I can't get to work. There are some changes in the MEF libraries, so for example - PartInitializer is renamed to CompositionInitializer.


    Here is the code I use, I could not comment out CompositionInitializer.SatisfyImports(this).


    public partial class MainPage : UserControl
            public IWordProcessor WordProcessor { get; set; }

            public MainPage()

            private void InitializeContainer()
                //TypeCatalog catalog = new TypeCatalog(
                //    typeof(WordProcessor), typeof(TextEngine));
                //AssemblyCatalog catalog1 = new AssemblyCatalog(typeof(TextEngine).Assembly);
                //AssemblyCatalog catalog2 = new AssemblyCatalog(typeof(WordProcessor).Assembly);
                //AggregateCatalog catalog = new AggregateCatalog(catalog1, catalog2);

                AggregateCatalog catalog = new AggregateCatalog();
                foreach (var assemblyPart in Deployment.Current.Parts)
                    StreamResourceInfo streamInfo = Application.GetResourceStream(new Uri(assemblyPart.Source, UriKind.Relative));
                    Assembly assembly = assemblyPart.Load(streamInfo.Stream);
                    catalog.Catalogs.Add(new AssemblyCatalog(assembly));
                CompositionContainer container = new CompositionContainer(catalog);

            private void Button_Click(object sender, RoutedEventArgs e)
                int x = 2;



    //Is it possible to comment out the call to SatisfyImports?