Is there a way to find why the Visual Studio 2019 won't minify a js file?

425 views Asked by At

I keep getting this error

scripts.render system.nullreferenceexception 'object reference not set to an instance of an object.'

I've ran my code through a number of different online minifiers to see what the issue could be and my code minifies without any issue on the online minifiers, except one, and it seems to not like template strings in this one file, but my other files use template strings and minify fine, so I am at a loss. Yes, I have looked online and not found any solutions other than "use new Bundle instead of new ScriptBundle"

I use ScriptBundle in my BundleConfig, I could just use new Bundle instead, and that works, however I can't have users do a ctrl+f5 everytime they hit the app so they get the updated javascript file.

I have looked through my code and found one issue, but that was all.

my stack trace is this, and nothing is popping out at me

System.NullReferenceException HResult=0x80004003 Message=Object reference not set to an instance of an object. Source=WebGrease StackTrace: at Microsoft.Ajax.Utilities.JSParser.ParseArrowFunction(AstNode parameters) at Microsoft.Ajax.Utilities.JSParser.ParseLeftHandSideExpression(Boolean isMinus) at Microsoft.Ajax.Utilities.JSParser.ParseUnaryExpression(Boolean& isLeftHandSideExpr, Boolean isMinus) at Microsoft.Ajax.Utilities.JSParser.ParseExpressionStatement(Boolean fSourceElement) at Microsoft.Ajax.Utilities.JSParser.ParseStatement(Boolean fSourceElement, Boolean skipImportantComment) at Microsoft.Ajax.Utilities.JSParser.ParseStatements(Block block) at Microsoft.Ajax.Utilities.JSParser.InternalParse() at Microsoft.Ajax.Utilities.JSParser.Parse(DocumentContext sourceContext) at Microsoft.Ajax.Utilities.Minifier.MinifyJavaScript(String source, CodeSettings codeSettings) at System.Web.Optimization.JsMinify.Process(BundleContext context, BundleResponse response) at System.Web.Optimization.Bundle.ApplyTransforms(BundleContext context, String bundleContent, IEnumerable1 bundleFiles) at System.Web.Optimization.Bundle.GenerateBundleResponse(BundleContext context) at System.Web.Optimization.Bundle.GetBundleResponse(BundleContext context) at System.Web.Optimization.BundleResolver.GetBundleContents(String virtualPath) at System.Web.Optimization.AssetManager.EliminateDuplicatesAndResolveUrls(IEnumerable1 refs) at System.Web.Optimization.AssetManager.DeterminePathsToRender(IEnumerable1 assets) at System.Web.Optimization.AssetManager.RenderExplicit(String tagFormat, String[] paths) at System.Web.Optimization.Scripts.RenderFormat(String tagFormat, String[] paths) at System.Web.Optimization.Scripts.Render(String[] paths) at ASP._Page_Views_Shared__AWLayout_cshtml.Execute() in D:\Site\AWOnline\Main\AW.Framework.UI\Views\Shared\_AWLayout.cshtml:line 23 at System.Web.WebPages.WebPageBase.ExecutePageHierarchy() at System.Web.Mvc.WebViewPage.ExecutePageHierarchy() at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) at System.Web.WebPages.WebPageBase.<>c__DisplayClass40_0.<RenderPageCore>b__0(TextWriter writer) at System.Web.WebPages.HelperResult.WriteTo(TextWriter writer) at System.Web.WebPages.WebPageBase.Write(HelperResult result) at System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action1 body) at System.Web.WebPages.WebPageBase.PopContext() at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) at System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) at System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)

0

There are 0 answers