... or how I learned to stop worrying and just write code against completely undocumented APIs from Microsoft. Is there any actual documentation of the official
I've got a similar problem.
In my class BundleConfig I was trying to see what was the effect of using BundleTable.EnableOptimizations = true.
public class BundleConfig
{
public static void RegisterBundles(BundleCollection bundles)
{
BundleTable.EnableOptimizations = true;
bundles.Add(...);
}
}
Everything was working fine.
At some point I was doing some debugging and set the property to false.
I struggled to understand what was happening cause it seemed that the bundle for jquery (the first one) wouldn't be resolved and loaded (/bundles/jquery?v=).
After some swearing I think(?!) I've managed to sort things out.
Try to add bundles.Clear() and bundles.ResetAll() at the beginning of the registration and things should start to work again.
public class BundleConfig
{
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Clear();
bundles.ResetAll();
BundleTable.EnableOptimizations = false;
bundles.Add(...);
}
}
I've realized I need to run these two methods only when I change the EnableOptimizations property.
UPDATE:
Digging deeper I've found out that BundleTable.Bundles.ResolveBundleUrl and @Scripts.Url seem to have problems to resolve the bundle path.
For sake of simplicity I've added a few images:

I have turned off the optimization and bundled a few scripts.

The same bundle is included in the body.

@Scripts.Url gives me the "optimized" path of the bundle while @Scripts.Render generates the proper one.
Same thing happens with BundleTable.Bundles.ResolveBundleUrl.
I am using Visual Studio 2010 + MVC 4 + Framework .Net 4.0.