微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

有没有办法找出为什么 Visual Studio 2019 不会缩小 js 文件?

如何解决有没有办法找出为什么 Visual Studio 2019 不会缩小 js 文件?

我一直收到这个错误

scripts.render system.nullreferenceexception '未将对象引用设置为对象的实例。'

我已经通过许多不同的在线缩小器运行了我的代码,以查看可能是什么问题,并且我的代码在在线缩小器上没有任何问题,除了一个,而且它似乎不喜欢这个文件中的模板字符串,但我的其他文件使用模板字符串并缩小得很好,所以我不知所措。是的,我在网上查了一下,除了“使用新的 Bundle 而不是新的 ScriptBundle”之外没有找到任何解决方

我在 BundleConfig 中使用 ScriptBundle,我可以只使用新的 Bundle 代替,这有效,但是我不能让用户每次点击应用程序时都按 ctrl+f5 来获取更新的 javascript 文件

我查看了我的代码并发现了一个问题,但仅此而已。

我的堆栈跟踪是这样的,没有任何东西出现在我身上

System.NullReferenceException HResult=0x80004003 Message=未将对象引用设置为对象的实例。 来源=WebGrease 堆栈跟踪: 在 Microsoft.Ajax.Utilities.JSParser.ParseArrowFunction(AstNode 参数) 在 Microsoft.Ajax.Utilities.JSParser.ParseLeftHandSideExpression(Boolean isMinus) 在 Microsoft.Ajax.Utilities.JSParser.ParseUnaryExpression(Boolean& isLeftHandSideExpr,Boolean isMinus) 在 Microsoft.Ajax.Utilities.JSParser.ParseExpressionStatement(Boolean fSourceElement) 在 Microsoft.Ajax.Utilities.JSParser.ParseStatement(Boolean fSourceElement,Boolean skipImportantComment) 在 Microsoft.Ajax.Utilities.JSParser.ParseStatements(块块) 在 Microsoft.Ajax.Utilities.JSParser.InternalParse() 在 Microsoft.Ajax.Utilities.JSParser.Parse(DocumentContext sourceContext) 在 Microsoft.Ajax.Utilities.Minifier.MinifyJavaScript(String source,CodeSettings codeSettings) 在 System.Web.Optimization.JsMinify.Process(BundleContext 上下文,BundleResponse 响应) 在 System.Web.Optimization.Bundle.ApplyTransforms(BundleContext 上下文,字符串 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) 在 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) 在 System.Web.WebPages.WebPageBase.PopContext() 在 System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext,WebPageRenderingBase startPage) 在 System.Web.Mvc.RazorView.RenderView(ViewContext viewContext,Object instance) 在 System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext,TextWriter writer) 在 System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext 上下文) 在 System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext,ActionResult actionResult) 在 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters,Int32 filterIndex,ResultExecutingContext preContext,ControllerContext controllerContext,ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 个过滤器,Int32 filterIndex,ResultExecutingContext preContext,ControllerContext controllerContext,ActionResult actionResult)

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。