L'Index était en dehors des limites du tableau dans @Scripts.Rendre

Pour chaque contrôleur de disposer d'un dossier (avec le même nom de controler), et pour chaque action, un fichier de script.

L'Index était en dehors des limites du tableau dans @Scripts.Rendre

Pour chaque fichier est de créer un bundle suivant le modèle: "~/Scripts/Controllers/{contrôleur-nom}/{nom de fichier sans extension}"

bundles.IncludePerFile(new DirectoryInfo(server.MapPath("~/Scripts/Controllers")), "~/Scripts/Controllers/{0}/{1}", 
    (dir,file) => string.Format("~/Scripts/Controllers/{0}/{1}", dir, Path.GetFileNameWithoutExtension(file)), "*.js");

IncludePerFile est une extension de la méthode que j'ai créé pour effectuer cette tâche

Puis un bundle pour: ~/Scripts/Controllers/processos/pasta doit exister!
Et pour confirmer cela:

L'Index était en dehors des limites du tableau dans @Scripts.Rendre

C'est très correct! Le bundle existe!

Application en cours d'exécution

Quand je lance l'application, l'erreur suivante se produit:

L'Index était en dehors des limites du tableau dans @Scripts.Rendre

L'image complète

À tort et inefficace pour réparer l'erreur:

Si je change ce:

@Scripts.Render("~/Scripts/Controllers/processos/pasta")

:

@Scripts.Render("~/Scripts/Controllers/processos/pasta.js")

Aucune erreur n'est générée. Mais le fichier n'est pas minimisé car il s'agit effectivement d'un bundle. (J'ai déjà mis en mode de diffusion et d'application publiés!)

D'erreur complet

Index was outside the bounds of the array.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
Exception Details: System.IndexOutOfRangeException: Index was outside the bounds of the array.
Source Error: 
Line 3:  @section js {
Line 4:     @*@Scripts.Render("~/Scripts/Controllers/processos/Pasta.js", "~/Scripts/Controllers/processos/display.js")*@
Line 5:     @Scripts.Render("~/Scripts/Controllers/processos/pasta")
Line 6:     @Scripts.Render("~/Scripts/Controllers/processos/display.js")
Line 7:  
Source File: w:\Clients\creditoimobiliariobb\sistema\src\CreditoImobiliarioBB\CreditoImobiliarioBB.Web\Views\processos\display.cshtml    Line: 5 
Stack Trace: 
[IndexOutOfRangeException: Index was outside the bounds of the array.]
System.String.get_Chars(Int32 index) +0
Microsoft.Ajax.Utilities.CssParser.Append(Object obj, TokenType tokenType) +402
Microsoft.Ajax.Utilities.CssParser.AppendCurrent() +74
Microsoft.Ajax.Utilities.CssParser.SkipToClose() +744
Microsoft.Ajax.Utilities.CssParser.SkipToEndOfStatement() +232
Microsoft.Ajax.Utilities.CssParser.ParseRule() +574
Microsoft.Ajax.Utilities.CssParser.ParseStylesheet() +1235
Microsoft.Ajax.Utilities.CssParser.Parse(String source) +897
Microsoft.Ajax.Utilities.Minifier.MinifyStyleSheet(String source, CssSettings settings) +419
System.Web.Optimization.CssMinify.Process(BundleContext context, BundleResponse response) +302
System.Web.Optimization.Bundle.ApplyTransforms(BundleContext context, String bundleContent, IEnumerable`1 bundleFiles) +207
System.Web.Optimization.Bundle.GenerateBundleResponse(BundleContext context) +355
System.Web.Optimization.Bundle.GetBundleResponse(BundleContext context) +104
System.Web.Optimization.BundleResolver.GetBundleContents(String virtualPath) +254
System.Web.Optimization.AssetManager.EliminateDuplicatesAndResolveUrls(IEnumerable`1 refs) +435
System.Web.Optimization.AssetManager.DeterminePathsToRender(IEnumerable`1 assets) +1029
System.Web.Optimization.AssetManager.RenderExplicit(String tagFormat, String[] paths) +75
System.Web.Optimization.Scripts.RenderFormat(String tagFormat, String[] paths) +292
System.Web.Optimization.Scripts.Render(String[] paths) +51
Avez-vous trouvé la réponse à cette question?
J'obtiens cette erreur. Le malveillant bundle comprend standard MVC5 Bootstrap js actifs.
La réponse est trop simple 🙂 Vous devez mettre à jour vos paquets (Microsoft Optimisation Web & WebGrease) fsou1.com/...

OriginalL'auteur ridermansb | 2013-05-08