title: MVC error in BundleConfig class: An exception of type 'System.NullReferenceException' occurred in mscorlib.dll
body: <p>My <strong>MVC</strong> website has an <code>Runtime Error</code> on starting in <code>BundleConfig</code> class with the following title:</p>
  
  <blockquote>
    <p>An exception of type 'System.NullReferenceException' occurred in
    mscorlib.dll but was not handled in user code</p>
  </blockquote>
  
  <p><img src="https://i.stack.imgur.com/YTthJ.jpg" alt="enter image description here"></p>
  
  <p><strong>Usings:</strong></p>
  
  <pre><code>using System.Web.Optimization;
  using BundleTransformer.Core.Bundles;
  using BundleTransformer.Core.Orderers;
  using BundleTransformer.Core.Transformers;
  </code></pre>
  
  <p><strong>Stack Trace:</strong></p>
  
  <pre><code>[NullReferenceException: Object reference not set to an instance of an object.]
     BundleTransformer.Core.BundleTransformerContext..ctor() +162
     BundleTransformer.Core.BundleTransformerContext.&lt;.cctor&gt;b__0() +44
     System.Lazy`1.CreateValue() +416
     System.Lazy`1.LazyInitValue() +152
     System.Lazy`1.get_Value() +75
     BundleTransformer.Core.BundleTransformerContext.get_Current() +60
     BundleTransformer.Core.Transformers.CssTransformer..ctor(IMinifier minifier, IList`1 translators, IList`1 postProcessors, String[] ignorePatterns) +79
     BundleTransformer.Core.Transformers.CssTransformer..ctor() +97
     NWebsite.BundleConfig.RegisterBundles(BundleCollection bundles) in d:\Documents\Visual Studio 2013\Projects\N\Web\N.Website\App_Start\BundleConfig.cs:18
     NWebsite.MvcApplication.Application_Start() in d:\Documents\Visual Studio 2013\Projects\N\Web\N.Website\Global.asax.cs:20
  
  [HttpException (0x80004005): Object reference not set to an instance of an object.]
     System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +9916613
     System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +118
     System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
     System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
     System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296
  
  [HttpException (0x80004005): Object reference not set to an instance of an object.]
     System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9930508
     System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
     System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254
  </code></pre>
  
  <p><strong>And MvcApplication class in Global.asax file:</strong></p>
  
  <pre><code>public class MvcApplication : System.Web.HttpApplication
  {
      protected void Application_Start()
      {
          AreaRegistration.RegisterAllAreas();
          GlobalConfiguration.Configure(WebApiConfig.Register);
          FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
          RouteConfig.RegisterRoutes(RouteTable.Routes);
          BundleConfig.RegisterBundles(BundleTable.Bundles);
      }
  }
  </code></pre>
  
  <p>What is it's reasons and how can i solve it?</p>