System.OutOfMemory Exception on loading Javascript libraries

686 Views Asked by At

In my application I have referenced JQWidget libraries and styles using Bundle options like below.

bundles.Add(new ScriptBundle("~/bundles/jqwidgets").Include(
                                    "~/JQWidgets/jqx-all.js",
                                    "~/JQWidgets/jqxcore.js",
                                    "~/JQWidgets/jqxdata.js",
                                    "~/JQWidgets/jqxgrid.js",
                                    "~/JQWidgets/jqxgrid.selection.js",
                                    "~/JQWidgets/jqxgrid.pager.js",
                                    "~/JQWidgets/jqxlistbox.js",
                                    "~/JQWidgets/jqxbuttons.js",
                                    "~/JQWidgets/jqxscrollbar.js",
                                    "~/JQWidgets/jqxdatatable.js",
                                    "~/JQWidgets/jqxtreegrid.js",
                                    "~/JQWidgets/jqxmenu.js",
                                    "~/JQWidgets/jqxcalendar.js",
                                    "~/JQWidgets/jqxgrid.sort.js",
                                    "~/JQWidgets/jqxgrid.filter.js",
                                    "~/JQWidgets/jqxdatetimeinput.js",
                                    "~/JQWidgets/jqxdropdownlist.js",
                                    "~/JQWidgets/jqxslider.js",
                                    "~/JQWidgets/jqxeditor.js",
                                    "~/JQWidgets/jqxinput.js",
                                    "~/JQWidgets/jqxdraw.js",
                                    "~/JQWidgets/jqxchart.core.js",
                                    "~/JQWidgets/jqxchart.rangeselector.js",
                                    "~/JQWidgets/jqxtree.js",
                                    "~/JQWidgets/globalize.js",
                                    "~/JQWidgets/jqxbulletchart.js",
                                    "~/JQWidgets/jqxcheckbox.js",
                                    "~/JQWidgets/jqxradiobutton.js",
                                    "~/JQWidgets/jqxvalidator.js",
                                    "~/JQWidgets/jqxpanel.js",
                                    "~/JQWidgets/jqxpasswordinput.js",
                                    "~/JQWidgets/jqxnumberinput.js",
                                    "~/JQWidgets/jqxcombobox.js",
                                    "~/JQWidgets/jqxgrid.edit.js",
                                    "~/JQWidgets/jqxgrid.columnsresize.js",
                                    "~/JQWidgets/jqxgrid.columnsreorder.js",
                                    "~/JQWidgets/jqxdata.js",
                                    "~/JQWidgets/jqxgrid.export.js",
                                    "~/JQWidgets/jqxdata.export.js",
                                    "~/JQWidgets/jqxgrid.grouping.js",
                                    "~/JQWidgets/jqxgrid.aggregates.js",
                                    "~/JQWidgets/jqxtabs.js",
                                    "~/JQWidgets/jqxwindow.js"
        ));
bundles.Add(new StyleBundle("~/JQWidgets/Styles/css").Include(
                                    "~/JQWidgets/Styles/jqx.base.css",
                                    "~/JQWidgets/Styles/jqx.arctic.css",
                                    "~/JQWidgets/Styles/jqx.black.css",
                                    "~/JQWidgets/Styles/jqx.bootstrap.css",
                                    "~/JQWidgets/Styles/jqx.classic.css",
                                    "~/JQWidgets/Styles/jqx.darkblue.css",
                                    "~/JQWidgets/Styles/jqx.energyblue.css",
                                    "~/JQWidgets/Styles/jqx.fresh.css",
                                    "~/JQWidgets/Styles/jqx.highcontrast.css",
                                    "~/JQWidgets/Styles/jqx.metro.css",
                                    "~/JQWidgets/Styles/jqx.metrodark.css",
                                    "~/JQWidgets/Styles/jqx.office.css",
                                    "~/JQWidgets/Styles/jqx.orange.css",
                                    "~/JQWidgets/Styles/jqx.shinyblack.css",
                                    "~/JQWidgets/Styles/jqx.summer.css",
                                    "~/JQWidgets/Styles/jqx.web.css",
                                    "~/JQWidgets/Styles/jqx.ui-darkness.css",
                                    "~/JQWidgets/Styles/jqx.ui-lightness.css",
                                    "~/JQWidgets/Styles/jqx.ui-le-frog.css",
                                    "~/JQWidgets/Styles/jqx.ui-overcast.css",
                                    "~/JQWidgets/Styles/jqx.ui-redmond.css",
                                    "~/JQWidgets/Styles/jqx.ui-smoothness.css",
                                    "~/JQWidgets/Styles/jqx.ui-start.css",
                                    "~/JQWidgets/Styles/jqx.ui-sunny.css",
                                    "~/JQWidgets/Styles/bootstrap.css",
                                    "~/JQWidgets/Styles/site.css"
            ));
BundleTable.EnableOptimizations = true;

And in my _Layout.cshtml I have referenced them like this in head and body tags respectively.

<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - Gulf Piping Company</title>
@Styles.Render("~/Content/css")
**@Styles.Render("~/jqwidgets/styles/css")**
@Scripts.Render("~/bundles/modernizr")
@Scripts.Render("~/bundles/jquery")

@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
**@Scripts.Render("~/bundles/jqwidgets")**
@Scripts.Render("~/bundles/ajax")
@RenderSection("scripts", required: false)

Now, since my application is in development stage, so I keep running the application, make changes and refresh the browser as required. After certain number of refreshes (cant tell how many), i get this error message.

enter image description here

I have to close browser, close Visual Studio and then re run Visual studio, load solution again and then run the appliction to overcome this error. Can any one tell me what is going on here?

Also, i have different views/pages in my application and some pages reference some of above JQWidget libraries and some don't (i.e. not all pages use all of these libraries), so is Bundling really the right way to use or there is a better way to reference libraries?

0

There are 0 best solutions below