This project has moved and is read-only. For the latest updates, please go here.

Asp.NET Mvc Demo CompositionProvider Bug

Sep 15, 2012 at 1:07 PM

It seems to me that there is a bug in the CompositionProvider class.
The following code sometimes throws NullReferenceException at startup:

internal static Export<CompositionContext> CurrentInitialisedScope
    get { return (Export<CompositionContext>)HttpContext.Current.Items[typeof(CompositionProvider)]; }
    private set { HttpContext.Current.Items[typeof(CompositionProvider)] = value; }

The reason is that the HttpContext.Current property is null. I've replaced it with a safer version in my code.