Esempio n. 1
0
        private static void AddContentToAdHocBundle(BundleContext context, string virtualPath, string content)
        {
            var mapBundle = context.BundleCollection.GetBundleFor(virtualPath);

            if (mapBundle == null)
            {
                mapBundle = new AdHocBundle(virtualPath);
                context.BundleCollection.Add(mapBundle);
            }
            var correctlyCastMapBundle = mapBundle as AdHocBundle;

            if (correctlyCastMapBundle == null)
            {
                throw new InvalidOperationException(string.Format("There is a bundle on the VirtualPath '{0}' of the type '{1}' when it was expected to be of the type 'SourceMapBundle'. That Virtual Path is reserved for the SourceMaps.", virtualPath, mapBundle.GetType()));
            }

            // Note: A current bug in AjaxMin reported by @LodewijkSioen here https://ajaxmin.codeplex.com/workitem/21834,
            // causes the MinifyJavascript method call to hang when debugger is attached if the following line is included.
            // To avoid more harm than good, don't support source mapping in this scenario until AjaxMin fixes it's bug.
            if (System.Diagnostics.Debugger.IsAttached)
            {
                correctlyCastMapBundle.SetContent(sourceMappingDisabledMsg);
                return;
            }

            correctlyCastMapBundle.SetContent(content);
        }
        private static void AddContentToAdHocBundle(BundleContext context, string virtualPath, string content)
        {
            var mapBundle = context.BundleCollection.GetBundleFor(virtualPath);

            if (mapBundle == null)
            {
                mapBundle = new AdHocBundle(virtualPath);
                context.BundleCollection.Add(mapBundle);
            }
            var correctlyCastMapBundle = mapBundle as AdHocBundle;

            if (correctlyCastMapBundle == null)
            {
                throw new InvalidOperationException(string.Format("There is a bundle on the VirtualPath '{0}' of the type '{1}' when it was expected to be of the type 'SourceMapBundle'. That Virtual Path is reserved for the SourceMaps.", virtualPath, mapBundle.GetType()));
            }

            correctlyCastMapBundle.SetContent(content);
        }
        private static void AddContentToAdHocBundle(BundleContext context, string virtualPath, string content)
        {
            var mapBundle = context.BundleCollection.GetBundleFor(virtualPath);
            if (mapBundle == null)
            {
                mapBundle = new AdHocBundle(virtualPath);
                context.BundleCollection.Add(mapBundle);
            }
            var correctlyCastMapBundle = mapBundle as AdHocBundle;
            if (correctlyCastMapBundle == null)
            {
                throw new InvalidOperationException(string.Format("There is a bundle on the VirtualPath '{0}' of the type '{1}' when it was expected to be of the type 'SourceMapBundle'. That Virtual Path is reserved for the SourceMaps.", virtualPath, mapBundle.GetType()));
            }

            // Note: A current bug in AjaxMin reported by @LodewijkSioen here https://ajaxmin.codeplex.com/workitem/21834,
            // causes the MinifyJavascript method call to hang when debugger is attached if the following line is included.
            // To avoid more harm than good, don't support source mapping in this scenario until AjaxMin fixes it's bug.
            if (System.Diagnostics.Debugger.IsAttached)
            {
                correctlyCastMapBundle.SetContent(sourceMappingDisabledMsg);
                return;
            }

            correctlyCastMapBundle.SetContent(content);
        }