_Layout.cshtml file fails when attempting to render the bootstrap 5 script bundle (works for earlier versions of bootstrap)
Try changing "new ScriptBundle" to "new Bundle" in your "RegisterBundles" within BundleConfig:
bundles.Add(new Bundle("~/bundles/bootstrap").Include("~/Scripts/bootstrap.js"));