0
votes

So I was modifying my javascript files. Before the modification, it can be bundled just fine, but after the modification, the bundling fails.

Object reference not set to an instance of an object.

[NullReferenceException: Object reference not set to an instance of an object.] Microsoft.Ajax.Utilities.FunctionObject.SafeIsReferenced(HashSet1 visited) +70 Microsoft.Ajax.Utilities.FunctionObject.SafeIsReferenced(HashSet1 visited) +295 Microsoft.Ajax.Utilities.JSVariableField.get_IsReferenced() +60 Microsoft.Ajax.Utilities.ActivationObject.AnalyzeNonGlobalScope() +92 Microsoft.Ajax.Utilities.ActivationObject.AnalyzeScope() +33 Microsoft.Ajax.Utilities.GlobalScope.AnalyzeScope() +83 Microsoft.Ajax.Utilities.JSParser.InternalParse() +1819 Microsoft.Ajax.Utilities.JSParser.Parse(DocumentContext sourceContext) +74 Microsoft.Ajax.Utilities.Minifier.MinifyJavaScript(String source, CodeSettings codeSettings) +592 System.Web.Optimization.JsMinify.Process(BundleContext context, BundleResponse response) +91 System.Web.Optimization.Bundle.ApplyTransforms(BundleContext context, String bundleContent, IEnumerable1 bundleFiles) +273 System.Web.Optimization.Bundle.GenerateBundleResponse(BundleContext context) +141 System.Web.Optimization.Bundle.GetBundleResponse(BundleContext context) +45 System.Web.Optimization.BundleResolver.GetBundleContents(String virtualPath) +166 System.Web.Optimization.AssetManager.DeterminePathsToRender(IEnumerable1 assets) +205 System.Web.Optimization.AssetManager.RenderExplicit(String tagFormat, String[] paths) +35 System.Web.Optimization.Scripts.RenderFormat(String tagFormat, String[] paths) +105 System.Web.Optimization.Scripts.Render(String[] paths) +21 ASP._Page_Views_Home_Customize_cshtml.b__3_1() in C:\Users\astef\Documents\Projects\C#\Yountrep\Yountrep\Yountrep\Views\Home\Customize.cshtml:429 System.Web.WebPages.<>c__DisplayClass42_0.b__0(TextWriter tw) +316 System.Web.WebPages.HelperResult.WriteTo(TextWriter writer) +10 System.Web.WebPages.WebPageBase.Write(HelperResult result) +80 ASP._Page_Views_Shared__Layout_cshtml.Execute() in C:\Users\astef\Documents\Projects\C#\Yountrep\Yountrep\Yountrep\Views\Shared_Layout.cshtml:134 System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +197 System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +105 System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +90 System.Web.WebPages.<>c__DisplayClass40_0.b__0(TextWriter writer) +232 System.Web.WebPages.HelperResult.WriteTo(TextWriter writer) +10 System.Web.WebPages.WebPageBase.Write(HelperResult result) +80 System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action1 body) +63 System.Web.WebPages.WebPageBase.PopContext() +237 System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +98 System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +235 System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +107 System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +291 System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +13 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +56 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +420 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList1 filters, ActionResult actionResult) +52 System.Web.Mvc.Async.<>c__DisplayClass3_6.b__4() +198 System.Web.Mvc.Async.<>c__DisplayClass3_1.b__1(IAsyncResult asyncResult) +100 System.Web.Mvc.Async.WrappedAsyncResult1.CallEndDelegate(IAsyncResult asyncResult) +10 System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +49 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +27 System.Web.Mvc.<>c.b__152_1(IAsyncResult asyncResult, ExecuteCoreState innerState) +11 System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +29 System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +49 System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +45 System.Web.Mvc.<>c.b__151_2(IAsyncResult asyncResult, Controller controller) +13 System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +22 System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +49 System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +26 System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10 System.Web.Mvc.<>c.b__20_1(IAsyncResult asyncResult, ProcessRequestState innerState) +28 System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +29 System.Web.Mvc.Async.WrappedAsyncResultBase1.End() +49 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +28 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9836613 System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +50 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +163

I am sure that this is caused by a syntax error in my javascript. The problem is that I cannot find the error, the javascript file has more than 1000 lines of code, and it show that it is fine in my visual studio (no syntax error).

How can I find this error? Is there any other tools I can use?

1
Does this answer your question? How to read/interpret a raw C# stack trace correctly?Liam
I dont know which line of code in my javascript causes the error, this stacktrace does not give me the informationAlvin Stefanus

1 Answers

0
votes

Bundling and minification does not support async function() which I have in my code. So i just change my async function into function().then();