2

当我将鼠标悬停在 asp.net mvc 视图的顶部时,Visual Studio intellisense 向我显示错误“检测到公共语言运行时和无效程序。这是我的视图的代码。

    @model SkillKindleWeb.ViewModels.BankDetails.IndexViewModel

    @{
        ViewBag.Title = "Bank Details";
        Layout = "~/Views/Shared/_TrainerLayout.cshtml";
    }


    @Html.Hidden("listUrl", Url.Action("List","bankDetails"))


    <div id="content-header">
        @Html.Partial("SummaryPartial", Model.BankDetails)
    </div>


@section scripts 
{
    @Scripts.Render("~/content/scripts/bankdetails")
}

如果我忽略它并尝试运行程序,我会得到同样的错误。附件是相同的堆栈跟踪。

我做了一切,但失败了。

提前致谢。

> [InvalidProgramException: Common Language Runtime detected an invalid
> program.]   
> System.Web.Razor.Parser.SyntaxTree.Block..ctor(BlockBuilder source) +0
> System.Web.Razor.Parser.SyntaxTree.BlockBuilder.Build() +195   
> System.Web.Razor.Parser.ParserContext.EndBlock() +336   
> System.Web.Razor.Utils.DisposableAction.Dispose(Boolean disposing)
> +292    System.Web.Razor.Utils.DisposableAction.Dispose() +181    System.Web.Razor.Parser.CSharpCodeParser.ParseBlock() +1133   
> System.Web.Razor.Parser.HtmlMarkupParser.OtherParserBlock() +285   
> System.Web.Razor.Parser.HtmlMarkupParser.SkipToAndParseCode(Func`2
> condition) +707   
> System.Web.Razor.Parser.HtmlMarkupParser.SkipToAndParseCode(HtmlSymbolType
> type) +353    System.Web.Razor.Parser.HtmlMarkupParser.ParseDocument()
> +367    System.Web.Razor.Parser.RazorParser.ParseCore(ITextDocument input) +493    System.Web.Razor.Parser.RazorParser.Parse(ITextDocument
> input) +233   
> System.Web.Razor.RazorTemplateEngine.GenerateCodeCore(ITextDocument
> input, String className, String rootNamespace, String sourceFileName,
> Nullable`1 cancelToken) +685   
> System.Web.Razor.RazorTemplateEngine.GenerateCode(TextReader input,
> String className, String rootNamespace, String sourceFileName,
> Nullable`1 cancelToken) +447   
> System.Web.Razor.RazorTemplateEngine.GenerateCode(TextReader input,
> String className, String rootNamespace, String sourceFileName) +374   
> System.Web.WebPages.Razor.RazorBuildProvider.EnsureGeneratedCode()
> +357    System.Web.WebPages.Razor.RazorBuildProvider.get_CodeCompilerType()
> +192    System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider
> buildProvider) +320   
> System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders()
> +558    System.Web.Compilation.BuildProvidersCompiler.PerformBuild() +187    System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) +826   
> System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath
> virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean
> allowBuildInPrecompile, Boolean throwIfNotFound, Boolean
> ensureIsUpToDate) +733   
> System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext
> context, VirtualPath virtualPath, Boolean noBuild, Boolean
> allowCrossApp, Boolean allowBuildInPrecompile, Boolean
> throwIfNotFound, Boolean ensureIsUpToDate) +143   
> System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath
> virtualPath, HttpContext context, Boolean allowCrossApp, Boolean
> throwIfNotFound) +222   
> System.Web.Compilation.BuildManager.GetObjectFactory(String
> virtualPath, Boolean throwIfNotFound) +337   
> System.Web.Mvc.BuildManagerWrapper.System.Web.Mvc.IBuildManager.FileExists(String
> virtualPath) +260   
> System.Web.Mvc.BuildManagerViewEngine.FileExists(ControllerContext
> controllerContext, String virtualPath) +312

我工作得很好,但由于某种原因,我开始遇到这个问题。即使现在完全相同的代码也可以在另一台机器上运行。我试过以下

  1. 清理解决方案
  2. 删除 C:\WINDOWS\Microsoft.NET\Framework{Version}\Temporary ASP.NET Files
  3. 重启机器。
4

1 回答 1

2

我认为从您的机器上清除临时文件。希望问题会消失

于 2013-05-18T19:49:58.440 回答