2

Visual studio intellisense shows me an error "Common Language Runtime detected and invalid program when I hover the mouse on the top of asp.net mvc view. Here is code of my view.

    @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")
}

If I ignore it and try to run the program it i get the same error. Attached is the stack trace for the same.

I have done everything but failed.

Thanks in advance.

> [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

I was working perfectly but for some reason I started getting this issue. Even now the exact same code works on another machine. I have tried the following

  1. Cleanup Solution
  2. Delete C:\WINDOWS\Microsoft.NET\Framework{Version}\Temporary ASP.NET Files
  3. Restarting machine.
Amit Kumar
  • 103
  • 1
  • 7

1 Answers1

2

I think clean temporary files from your machine. Hope the problem would be disappear

Hasib Tarafder
  • 5,773
  • 3
  • 30
  • 44
  • Thank Hasib. It worked after I deleted bin and obj folder in every project. I am not sure why clean project did not work. – Amit Kumar May 22 '13 at 06:52