title: Object reference not set to an instance of an object in _Layout.cshtml after updated packages
body: <p>The project was running fine until I updated all NuGet packages via
  NuGet Manager (I was trying to get the latest OWIN packages).</p>
  <p>This error is in the <code>_Layout.cshtml</code> and I have not touched it at all.</p>
  <blockquote>
  <p>Object reference not set to an instance of an object.</p>
  <p>Description: An unhandled exception occurred during the execution of
  the current web request. Please review the stack trace for more
  information about the error and where it originated in the code.</p>
  <p>Exception Details: <code>System.NullReferenceException</code>: Object reference not
  set to an instance of an object.</p>
  <p>Source Error:</p>
  <pre><code>Line 13:  
  Line 14:     &lt;!-- Custom Fonts --&gt;
  Line 15:     @Scripts.Render(&quot;~/Content/fonts&quot;)
  </code></pre>
  <p>Source File: f:\Workplace\lrc\lrc\Views\Shared_Layout.cshtml    Line:
  15</p>
  </blockquote>
  <hr />
  <h3>Update</h3>
  <p>Here is the code in the <code>_Layout.cshtml</code> (they are automatically generated when creating the project):</p>
  <pre class="lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta charset=&quot;utf-8&quot; /&gt;
      &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&gt;
      &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;
      &lt;meta name=&quot;description&quot; content=&quot;LRC - We are aiming at building up a healthier life style.&quot;&gt;
      &lt;meta name=&quot;author&quot; content=&quot;Winston Fan&quot;&gt;
      &lt;title&gt;@ViewBag.Title - LRC&lt;/title&gt;
      @Styles.Render(&quot;~/Content/css&quot;)
      @Scripts.Render(&quot;~/bundles/modernizr&quot;)
  
      &lt;!-- Custom Fonts --&gt;
      @Scripts.Render(&quot;~/Content/fonts&quot;)
      
      &lt;link href=&quot;http://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&gt;
      &lt;link href=&quot;http://fonts.googleapis.com/css?family=Montserrat:400,700&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&gt;
  </code></pre>
  <p>So it is complaining this line of code:</p>
  <pre><code>@Scripts.Render(&quot;~/Content/fonts&quot;)
  </code></pre>
  <p>But as you can see that, this is VS generated code, how could I make it wrong?</p>
  <p>I also checked the content in the <code>Conntent/font-awesome/fonts</code> folder and all required resources are there.</p>
  <p>Here is the code inside the <code>BundleConfig</code> (which is also the auto-generated code):</p>
  <pre class="lang-csharp prettyprint-override"><code>bundles.Add(new ScriptBundle(&quot;~/Content/fonts&quot;).Include(
                &quot;~/Content/font-awesome/fonts/fontawesome-*&quot;,
                &quot;~/Content/font-awesome/fonts/FontAwesome.otf&quot;));
  </code></pre>
  <p>My <code>Microsoft.OWin.Security</code>, <code>Microsoft.OWin.Security.Google</code> and <code>Microsoft.OWin</code> are version <code>3.0.1.0</code>.</p>
  <hr />
  <h3>Update 2</h3>
  <p>Here is the stack trace:</p>
  <blockquote>
  <pre><code>[NullReferenceException: Object reference not set to an instance of an
  object.]    Microsoft.Ajax.Utilities.JSParser.ParseExpression(AstNode
  leftHandSide, Boolean single, Boolean bCanAssign, JSToken inToken)
  +1007    Microsoft.Ajax.Utilities.JSParser.ParseExpressionStatement(Boolean
  fSourceElement) +268   
  Microsoft.Ajax.Utilities.JSParser.ParseStatement(Boolean
  fSourceElement, Boolean skipImportantComment) +1552   
  Microsoft.Ajax.Utilities.JSParser.ParseBlock() +164   
  Microsoft.Ajax.Utilities.JSParser.ParseStatement(Boolean
  fSourceElement, Boolean skipImportantComment) +498   
  Microsoft.Ajax.Utilities.JSParser.ParseBlock() +164   
  Microsoft.Ajax.Utilities.JSParser.ParseStatement(Boolean
  fSourceElement, Boolean skipImportantComment) +498   
  Microsoft.Ajax.Utilities.JSParser.ParseBlock() +164   
  Microsoft.Ajax.Utilities.JSParser.ParseStatement(Boolean
  fSourceElement, Boolean skipImportantComment) +498   
  Microsoft.Ajax.Utilities.JSParser.ParseStatements(Block block) +159   
  Microsoft.Ajax.Utilities.JSParser.InternalParse() +1011   
  Microsoft.Ajax.Utilities.JSParser.Parse(DocumentContext sourceContext)
  +123    Microsoft.Ajax.Utilities.JSParser.Parse(DocumentContext sourceContext, CodeSettings settings) +54   
  Microsoft.Ajax.Utilities.Minifier.MinifyJavaScript(String source,
  CodeSettings codeSettings) +987   
  System.Web.Optimization.JsMinify.Process(BundleContext context,
  BundleResponse response) +310   
  System.Web.Optimization.Bundle.ApplyTransforms(BundleContext context,
  String bundleContent, IEnumerable`1 bundleFiles) +263   
  System.Web.Optimization.Bundle.GenerateBundleResponse(BundleContext
  context) +355   
  System.Web.Optimization.Bundle.GetBundleResponse(BundleContext
  context) +104   
  System.Web.Optimization.BundleResolver.GetBundleContents(String
  virtualPath) +254   
  System.Web.Optimization.AssetManager.DeterminePathsToRender(IEnumerable`1
  assets) +252   
  System.Web.Optimization.AssetManager.RenderExplicit(String tagFormat,
  String[] paths) +75   
  System.Web.Optimization.Scripts.RenderFormat(String tagFormat,
  String[] paths) +292   
  System.Web.Optimization.Scripts.Render(String[] paths) +51   
  ASP._Page_Views_Shared__Layout_cshtml.Execute() in
  f:\Workplace\lrc\lrc\Views\Shared\_Layout.cshtml:15   
  System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +271   
  System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +121   
  System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext
  pageContext, TextWriter writer, WebPageRenderingBase startPage) +145  
  System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext
  pageContext, TextWriter writer) +41   
  System.Web.WebPages.&lt;&gt;c__DisplayClass3.&lt;RenderPageCore&gt;b__2(TextWriter
  writer) +335    System.Web.WebPages.HelperResult.WriteTo(TextWriter
  writer) +42   
  System.Web.WebPages.WebPageExecutingBase.WriteTo(TextWriter writer,
  HelperResult content) +45   
  System.Web.WebPages.WebPageBase.Write(HelperResult result) +53   
  System.Web.WebPages.WebPageBase.RenderSurrounding(String
  partialViewName, Action`1 body) +178   
  System.Web.WebPages.WebPageBase.PopContext() +229   
  System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext
  pageContext, TextWriter writer, WebPageRenderingBase startPage) +154  
  System.Web.Mvc.RazorView.RenderView(ViewContext viewContext,
  TextWriter writer, Object instance) +695   
  System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext
  viewContext, TextWriter writer) +382   
  System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
  +431    System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext
  controllerContext, ActionResult actionResult) +39   
  System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1
  filters, Int32 filterIndex, ResultExecutingContext preContext,
  ControllerContext controllerContext, ActionResult actionResult) +116  
  System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1
  filters, Int32 filterIndex, ResultExecutingContext preContext,
  ControllerContext controllerContext, ActionResult actionResult) +529  
  System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext
  controllerContext, IList`1 filters, ActionResult actionResult) +106   
  System.Web.Mvc.Async.&lt;&gt;c__DisplayClass2b.&lt;BeginInvokeAction&gt;b__1c()
  +321    System.Web.Mvc.Async.&lt;&gt;c__DisplayClass21.&lt;BeginInvokeAction&gt;b__1e(IAsyncResult
  asyncResult) +185   
  System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult
  asyncResult) +42   
  System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +133   
  System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult,
  Object tag) +56   
  System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult
  asyncResult) +40   
  System.Web.Mvc.Controller.&lt;BeginExecuteCore&gt;b__1d(IAsyncResult
  asyncResult, ExecuteCoreState innerState) +34   
  System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult
  asyncResult) +70   
  System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +139   
  System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult,
  Object tag) +59   
  System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult,
  Object tag) +40   
  System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +44
  System.Web.Mvc.Controller.&lt;BeginExecute&gt;b__15(IAsyncResult
  asyncResult, Controller controller) +39   
  System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult
  asyncResult) +62   
  System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +139   
  System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult,
  Object tag) +59   
  System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult,
  Object tag) +40    System.Web.Mvc.Controller.EndExecute(IAsyncResult
  asyncResult) +39   
  System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult
  asyncResult) +39   
  System.Web.Mvc.MvcHandler.&lt;BeginProcessRequest&gt;b__5(IAsyncResult
  asyncResult, ProcessRequestState innerState) +39   
  System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult
  asyncResult) +70   
  System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +139   
  System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult,
  Object tag) +59   
  System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult,
  Object tag) +40   
  System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
  +40    System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult
  result) +38   
  System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
  +932    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +188
  </code></pre>
  </blockquote>
  <hr />
  <h3>Update 3</h3>
  <p>Here is the <code>Content</code> folder:</p>
  <p><img src="https://i.stack.imgur.com/lciDc.png" alt="enter image description here" /></p>
  <hr />
  <h3>Update 4</h3>
  <p>Here is the content of the <code>packages.config</code>:</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;packages&gt;
    &lt;package id=&quot;Antlr&quot; version=&quot;3.5.0.2&quot; targetFramework=&quot;net451&quot; /&gt;
    &lt;package id=&quot;bootstrap&quot; version=&quot;3.3.4&quot; targetFramework=&quot;net451&quot; /&gt;
    &lt;package id=&quot;EntityFramework&quot; version=&quot;6.1.3&quot; targetFramework=&quot;net451&quot; /&gt;
    &lt;package id=&quot;jQuery&quot; version=&quot;2.1.3&quot; targetFramework=&quot;net451&quot; /&gt;
    &lt;package id=&quot;jQuery.Validation&quot; version=&quot;1.13.1&quot; targetFramework=&quot;net451&quot; /&gt;
    &lt;package id=&quot;Microsoft.AspNet.Identity.Core&quot; version=&quot;2.2.1&quot; targetFramework=&quot;net451&quot; /&gt;
    &lt;package id=&quot;Microsoft.AspNet.Identity.EntityFramework&quot; version=&quot;2.2.1&quot; targetFramework=&quot;net451&quot; /&gt;
    &lt;package id=&quot;Microsoft.AspNet.Identity.Owin&quot; version=&quot;2.2.1&quot; targetFramework=&quot;net451&quot; /&gt;
    &lt;package id=&quot;Microsoft.AspNet.Mvc&quot; version=&quot;5.2.3&quot; targetFramework=&quot;net451&quot; /&gt;
    &lt;package id=&quot;Microsoft.AspNet.Razor&quot; version=&quot;3.2.3&quot; targetFramework=&quot;net451&quot; /&gt;
    &lt;package id=&quot;Microsoft.AspNet.Web.Optimization&quot; version=&quot;1.1.3&quot; targetFramework=&quot;net451&quot; /&gt;
    &lt;package id=&quot;Microsoft.AspNet.WebApi&quot; version=&quot;5.2.3&quot; targetFramework=&quot;net451&quot; /&gt;
    &lt;package id=&quot;Microsoft.AspNet.WebApi.Client&quot; version=&quot;5.2.3&quot; targetFramework=&quot;net451&quot; /&gt;
    &lt;package id=&quot;Microsoft.AspNet.WebApi.Core&quot; version=&quot;5.2.3&quot; targetFramework=&quot;net451&quot; /&gt;
    &lt;package id=&quot;Microsoft.AspNet.WebApi.WebHost&quot; version=&quot;5.2.3&quot; targetFramework=&quot;net451&quot; /&gt;
    &lt;package id=&quot;Microsoft.AspNet.WebPages&quot; version=&quot;3.2.3&quot; targetFramework=&quot;net451&quot; /&gt;
    &lt;package id=&quot;Microsoft.jQuery.Unobtrusive.Validation&quot; version=&quot;3.2.3&quot; targetFramework=&quot;net451&quot; /&gt;
    &lt;package id=&quot;Microsoft.Owin&quot; version=&quot;3.0.1&quot; targetFramework=&quot;net451&quot; /&gt;
    &lt;package id=&quot;Microsoft.Owin.Host.SystemWeb&quot; version=&quot;3.0.1&quot; targetFramework=&quot;net451&quot; /&gt;
    &lt;package id=&quot;Microsoft.Owin.Security&quot; version=&quot;3.0.1&quot; targetFramework=&quot;net451&quot; /&gt;
    &lt;package id=&quot;Microsoft.Owin.Security.Cookies&quot; version=&quot;3.0.1&quot; targetFramework=&quot;net451&quot; /&gt;
    &lt;package id=&quot;Microsoft.Owin.Security.Facebook&quot; version=&quot;3.0.1&quot; targetFramework=&quot;net451&quot; /&gt;
    &lt;package id=&quot;Microsoft.Owin.Security.Google&quot; version=&quot;3.0.1&quot; targetFramework=&quot;net451&quot; /&gt;
    &lt;package id=&quot;Microsoft.Owin.Security.MicrosoftAccount&quot; version=&quot;3.0.1&quot; targetFramework=&quot;net451&quot; /&gt;
    &lt;package id=&quot;Microsoft.Owin.Security.OAuth&quot; version=&quot;3.0.1&quot; targetFramework=&quot;net451&quot; /&gt;
    &lt;package id=&quot;Microsoft.Owin.Security.Twitter&quot; version=&quot;3.0.1&quot; targetFramework=&quot;net451&quot; /&gt;
    &lt;package id=&quot;Microsoft.Web.Infrastructure&quot; version=&quot;1.0.0.0&quot; targetFramework=&quot;net451&quot; /&gt;
    &lt;package id=&quot;Modernizr&quot; version=&quot;2.8.3&quot; targetFramework=&quot;net451&quot; /&gt;
    &lt;package id=&quot;Newtonsoft.Json&quot; version=&quot;6.0.8&quot; targetFramework=&quot;net451&quot; /&gt;
    &lt;package id=&quot;Owin&quot; version=&quot;1.0&quot; targetFramework=&quot;net451&quot; /&gt;
    &lt;package id=&quot;Respond&quot; version=&quot;1.4.2&quot; targetFramework=&quot;net451&quot; /&gt;
    &lt;package id=&quot;WebGrease&quot; version=&quot;1.6.0&quot; targetFramework=&quot;net451&quot; /&gt;
  &lt;/packages&gt;
  </code></pre>