Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CompilationLock error in web forms page directive

My company has a web forms project that we converted to an MVC 3 project over a month ago. Everything works great except for this annoying error that the parser gives on web forms page directives. I'm not sure when this started. I only just started noticing it a week ago, but it could have been there since we transitioned the project.

We followed this tutorial when modifying our web forms project to support MVC 3. The project compiles just fine. Beyond this annoying underline (shown below) there is no problem. Web forms and MVC have played nice together so far. However, intellisense within .ASPX markup does not work while the parser is displaying this error.

Image

The type initializer for 'System.Web.Compilation.CompilationLock' threw an exception.

Does anyone have any experience with this issue? I have scanned the web.config as well as unloaded the project and scanned the .csproj xml. I can't see anything wrong but I also don't really know what I'm looking for. Google doesn't turn up anything useful for this error in my situation.

like image 512
Chev Avatar asked Dec 03 '25 19:12

Chev


2 Answers

I'm still not sure what was causing this. But a complete re-install of .NET and Visual Studio fixed the issue.

like image 160
Chev Avatar answered Dec 06 '25 08:12

Chev


I ran into a similar issue with my ASP.NET Web Site not building and producing the same useless error.

For me, the solution was fixing the capitalization of the sessionState mode in my Web.config:

<sessionState mode="Off"/>

(It may be 9 years too late, but I wanted this answer to be documented literally anywhere on the internet.)

like image 38
Trace Bullet Avatar answered Dec 06 '25 10:12

Trace Bullet



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!