Public Hotfix Patch Available for ASP.NET Compilation Issues

Over the last year we've found and fixed a few ASP.NET 2.0 compilation bugs that people have reported running into. 

The cause of these bugs is varied - but the root cause usually is related to having projects structured with particular cross page circular dependencies, and they are often triggered when massive file-changes occurs on the system (for example: an anti-virus program updates all of the timestamps on files at once). 

Example Error Messages:

The below error messages are examples of the types of runtime exceptions you might see if you run into one of these compilation issues:

Unable to cast object of type 'ASP.masterpage_master' to type 'ASP.masterpage_master'.

Or:

Could not load file or assembly 'App_Web_e9dbmaj, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
Or:
Compiler Error Message: CS0006: Metadata file 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\cms.web\44e73607\b028acb3\App_global.asax.fakktchx.dll' could not be found
Or:
System.InvalidOperationException: The resource class for this page was not found. Please check if the resource file exists and try again
Workaround for these issues:

If you have an application that starts throwing one of these errors, you can usually apply an immediate workaround that fixes it by opening your application's web.config file and setting the batch="false" attribute on the <compilation> section:

<configuration>

   
<system.web>
       
<compilation debug="false" batch="false"></compilation>
   
</system.web>

</configuration>

This tells ASP.NET to dynamically compile individual .aspx/.ascx files into separate assemblies.  This avoids the circular reference issue that triggers the exception.

You can also temporarily fix it by deleting the files within the "Temporary ASP.NET Files" Cache using the below steps:

  1. Click the Windows Start button, click Run, type iisreset /stop, and then click OK.
  2. Open the DriveLetter: WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files directory.
  3. Delete all files and all folders in the directory that you located in step 2.
  4. Click Start, click Run, type iisreset /start, and then click OK.

More details on these workarounds can be found in Microsoft KB #934839.

QFE HotFix Patch for these issues now available for download:

As an alternative to applying the above configuration workaround, you can also now download and apply a Microsoft QFE HotFix patch that fixes the reported compilation issues we've seen. 

The direct download link to this compilation QFE HotFix patch is here.  You can find other commonly requested Visual Studio and .NET Framework QFE HotFixes on this page here.

Important: People sometimes ask me whether they should install QFE HotFixes proactively (before they ever seen an issue).  I always recommend against doing this - since QFE hotfixes go through targeted testing (to verify a specific issue is fixed), and don't go through a complete product end to end sign-off.  As such, I'd recommend only applying one of if you are running into the specific issue it targets above. 

Contacting Microsoft Product Support:

If you have any problems installing the patch or find that you still see compilation issues after you install it, you'll want to contact Microsoft product support for assistance and they'll help debug it further.  Calls to Microsoft Product Support are free if they are related to a product bug (either a QFE HotFix request or a product bug you are running into).  You can find details on how to contact Microsoft product support on this page (it allows you to lookup the local phone number to use by country).

Most versions of Visual Studio also come with free product support tickets (for example: VS Pro with MSDN Premium comes with 4 support tickets per subscription).  You can use these support tickets for getting help using .NET or Visual Studio (for example: to get help chasing down a bug or performance problem in your own code, or to learn how to use a particular feature in the framework or IDE). 

There are some really, really phenomenal engineers in Microsoft product support who are great to work with if you have problems.  Here are some fantastic blogs that I highly recommend subscribing to from a few of them in the .NET Framework / Visual Studio space:

If you ever run into a problem you can't figure out, or have an issue with a production application that you want immediate help on, give Microsoft product support a call and you'll have someone like the folks above attach a debugger and help you figure out what is going on.

Thanks,

Scott

Published Wednesday, April 11, 2007 10:39 PM by ScottGu

Comments

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Thursday, April 12, 2007 2:03 AM by Steve Hardin

I've seen these errors and usually restarting VS solves most of the problems for me.  Thanks for the info and hot fix, helpful.

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Thursday, April 12, 2007 3:08 AM by fixed

man, glad you had a blog.

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Thursday, April 12, 2007 4:36 AM by Manso

Thanks, exactly what we've been waiting for. However, when trying to apply this hotfix we got a message saying it couldn't be applied because the correct products weren't installed. We have VS 2005 SP1 + "Visual Studio 2005 Service Pack 1 Update for Windows Vista" installed. Do you think that's the problem?

# &raquo; Public Hotfix Patch Available for ASP.NET Compilation Issues

PingBack from http://test3.netmoviehost.com/public-hotfix-patch-available-for-aspnet-compilation-issues/

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Thursday, April 12, 2007 5:31 AM by Wallym

thanks for the info Scott.  I think its good that you guys are forthcoming regarding issues like this.  :-)

# About Time!

Thursday, April 12, 2007 7:18 AM by Tom

We've been having this problem since VS 2005 Beta 1, about 2 years ago.  Nice to know it is finally fixed, but what took so long!

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Thursday, April 12, 2007 9:16 AM by Ben

Scott,

Thanks for posting a link to download the hotfix. I'm disappointed to report that to actually get the (2.21 MB) hotfix you have to overcome the following hurdles:-

* Sign in / create a Microsoft "Connect" account

* Using Firefox; don't bother as it simply doesn't work (I assume this is the same for all non-IE browsers)

* Using IE7; you must install an ActiveX control (Microsoft File Transfer Manager) to finally download the file (which gets downloaded to a subfolder, "KB934839", of the requested destination)

I fully understand that you have no control over this process but it is infuriating for the end user. Why does Microsoft insist on making the simplest of tasks (downloading a small file from the internet) such a convoluted process?

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Thursday, April 12, 2007 10:27 AM by John S.

Thanks Scott for posting this patch. That master page type issue was driving me crazy!

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Thursday, April 12, 2007 10:33 AM by bungle

We have been testing beta version of this fix (and now also this official public fix). It certainly helps, but it doesn't fix the problem totally. From time to time we are still getting the same errors but not as frequently as before applying the hotfix.

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Thursday, April 12, 2007 10:43 AM by Joel Varty

Scott - if this works reliably it will like christmas in April...  This happens with ALL my web sites when they get to a certain size.

nasty.  Cheerio!!

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Thursday, April 12, 2007 11:31 AM by ScottGu

Hi Manso,

I believe most of the fixes in the QFE are already rolled into the Vista version of ASP.NET.  Are you seeing issues on Vista?  If so, can you send me email (scottgu@microsoft.com) and I'll put you in touch with someone who can help get a vista version of the QFE for you.

Thanks,

Scott

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Thursday, April 12, 2007 11:35 AM by ScottGu

Hi Tom,

The initial hotfix is something people were actually able to get from Microosft Product Support for about 9-10 months.  Over time we then added more compilation related fixes into it (so it has gotten better and better).

In general if you ever run into what feels like a product bug, I always recommend calling product support - since they can help and give you patches.

I've seen enough people recently who weren't aware of this patch/KB - which is why I pushed to have it available as a public download and blogged about it.  

Sorry for the delay in broadcasting this more!

Scott

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Thursday, April 12, 2007 11:36 AM by ScottGu

Hi Bungle,

Can you send me an email (scottgu@microsoft.com) with details on the issue above? I can then make sure someone is tracking them and identifying why you might only be seeing a partial fix.

Thanks,

Scott

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Thursday, April 12, 2007 1:42 PM by Hillarie

Good to see you post this as I was involved with debugging and working with Microsoft Support on this issue.  We didn't see this exception as often as some, but it was a welcome and somewhat surprising relief to get in touch with a tech support rep who knew what they were talking about.  I could discuss the code we were running and did not doubt for a second the person on the other end of the line understood what I was saying.  Maybe my expectations were too low before then, but I was more than satisfied with our support experience.  

The workarounds you listed are only temporary and will just delay the inevitable return of the exception, but I think this latest hotfix will do the trick.  The inital hotfix you reference as being available 9-10 months ago didn't solve our problem either, which is what prompted me to open a support ticket with Microsoft.  

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Thursday, April 12, 2007 6:24 PM by Olavo Neto

Hi Scott!

This is great news,

but what about the ASP.net 2.0 patch for validators in ASP.net AJAX, any news about it?

I haven't heard anything about it lately. :-(

Olavo

Belém - Brazil

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Thursday, April 12, 2007 10:13 PM by Vikram

Have not seen this error as yet. And as you said will not apply this till I find this. :)

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Thursday, April 12, 2007 10:25 PM by Brennan Stehling

I am glad to see a patch out for this problem. I find that it often hits it the worst time, like late on a Saturday night or Sunday morning. In those cases my best guess the cause is the worker process going to sleep due to a the idle period. The problem happens when it is rudely awakened by a fresh request a few hours later and attempts to run the compilation process and comes across the problems you describe here. The batch is a good way to solve it, but you could also extend your idle time for the worker process to avoid the weekend headaches.

I am also glad you mentioned this now because I have always had it in the back of my mind that I had somehow done something wrong with my deployments. Another way I found I could prevent these errors from happening was to copy the files for the website to the server in a non-live location. Then log into the server (RD) and quickly copy the files in place. The slow copy over a remote connection seemed to cause the compiler to get confused with new files being dropped in over and over as the new file are uploaded. I look forward to this fix going into a full update.

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Thursday, April 12, 2007 11:49 PM by ScottGu

Hi Olavo,

The patch for the ASP.NET AJAX validators was unfortunately delayed due to a patch setup problem (we were hoping to ship it this week).

The team is now looking for an alternative way to make it available sooner to folks.

Sorry for the delay - until then you can use the web download I pointed to earlier to install the validator functionality.

Hope this helps,

Scott

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Friday, April 13, 2007 12:01 AM by sergiotarrillo

Hi Scott!

I installed VS2005-SP1, and now when I call to publish web, I have same problem: "Index was outside the bounds of the array", and not publish web Site: http://support.microsoft.com/kb/933608.

But, I don't find the link for download this hotfix :S. There are some public place, where I can download this hotfix?

Saludos,

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Friday, April 13, 2007 1:42 AM by ScottGu

Hi Sergio,

The index out of range issue you are seeing above is actually not an ASP.NET issue, but rather a VS regression introduced in SP1 when you use root referenced web-sites.  If you send me an email about it I can get you access to the hotfix that fixes it.

Thanks,

Scott

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Friday, April 13, 2007 3:37 AM by Jinn

This is very helpful thanks for the post!

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Friday, April 13, 2007 7:06 AM by Juan maría

Hi:

You can read this in spanish here:

http://thinkingindotnet.wordpress.com/2007/04/13/parche-para-algunos-problemas-de-compilacion-de-asp-net/

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Friday, April 13, 2007 7:41 AM by Ray

Scott,

  This is exactly what I was looking for.  Is there a version of the patch for 64-bit systems?  If so, could you post a link?

Thanks,

  Ray

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Friday, April 13, 2007 8:10 AM by Peter Bridger

We've seen this problem crop up whenever we make changes to user controls (.ascx files) on our asp.net 2.0 website (making extensive use of Master Pages)

I really hope this fixes the issue!

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Friday, April 13, 2007 9:39 AM by sergiotarrillo

Thanks Scott!

Saludos,

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Friday, April 13, 2007 10:32 AM by Nate K

I can not get to that page for the life of me!  I click on the download and I get a page missing error.

Nate

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Friday, April 13, 2007 10:35 AM by JD

I just tried to download the file to apply this fix and get a page not found error.

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Friday, April 13, 2007 2:31 PM by Morten

Seems a little overkill to distribute it with the file transfer manager, when it is only 2.2mb.

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Friday, April 13, 2007 7:37 PM by Song

Thanks for posting about this!

Hotfix is working great in my case.  No problem for close to 2 weeks since the patch.

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Saturday, April 14, 2007 2:34 AM by KAmran Shahid

Does this hotfix is required for the project using webapplication project.

I have download the web application project add in then we have build a very large project on it.

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Saturday, April 14, 2007 3:41 AM by Denis Abt

Thanks for posting this hotfix publicly at last. I have been fighting with this issue for a long time and usually did a "Clean build" and "Rebuild All" workaround. Then changing the debug setting already helped, but didn't satisfy me. I am glad to see that this should now be fixed for good - thanks !

Denis

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Saturday, April 14, 2007 10:59 AM by Timmy

Hi Scott,

  I have seen these errors whenever I re-published my website (I am using ASP .NET 2). Usually, reopening the page would solve the problem, but I still want to know why. You said the root cause is, among other things, having projects structured with particular cross page circular dependencies. Can you explain in details (or give an example) what cross page circular dependencies is?

Thanks,

Timmy

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Monday, April 16, 2007 4:48 AM by Shaun Trennery

I get the following error when trying to publish a Visual Studio 2005 project. It complies with no errors or warnings.

Index was outside the bounds of the array

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Monday, April 16, 2007 2:50 PM by Stuart

Does this solve the access issue that one might run into when creating a user control that needs to cast his parent's Page class in order to utilize specific methods/properties of the host page?

I don't want to use the Web Application Project model to get around this. I like my App_Code.

Scott, any other suggestions?

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Tuesday, April 17, 2007 12:14 AM by Dennis

How to get the x64 versions? I tried the page on several machines and it all tries to give me the 32bit update.

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Wednesday, April 18, 2007 1:13 PM by ScottGu

Hi Stuart,

If you want to load and cast a user-control you can do one of two things:

1) Add a <%@ Reference %> directive at the top of the page that dynamically loads the user control.  This will compile a reference to it and allow you to cast.

2) Have the user control derive from a base class or an interface defined within your /app_code directory.  This will also allow you to cast.

Hope this helps,

Scott

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Wednesday, April 18, 2007 1:15 PM by ScottGu

Hi Shaun,

The index out of range issue is actually a VS bug.  We have a fix for it that we are going to be making public soon.  If you send me email I can give you access to it earlier.

Thanks,

Scott

# error persists

Thursday, April 19, 2007 11:29 AM by cheng.

Hi Scott, after i applied the hotfix and rebooted the machine, now it generates new error messages as below, now the project creates two folders (\web\343a3840 & \web\343a3840) under temporary files foler, and this happens when i set  <compilation debug="true"> in web.config, however if set to <compilation debug="false" batch="false">, the error is gone, but kinda defeat the hotfix purpose isn't it?

any suggestions? cheers.

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0433: The type 'XXXX' exists in both 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\web\343a3840\161a4bd8\App_Web_occfvcy7.dll' and 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\web\343a3840\161a4bd8\App_Web_evocakau.dll'

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Wednesday, April 25, 2007 4:54 PM by Jim C

Does it fix this error?:

"The name 'UserControls_CompanyInfo' does not exist in the current context"

The error is on this line (file: public partial class UserControls_CompanyContacts : System.Web.UI.UserControl):

UserControls_CompanyInfo.CompanyCreated += new Helper.CompanyCreatedDelegate(Helper_CompanyCreated);

I reference a public static event in this class:

public partial class UserControls_CompanyInfo : System.Web.UI.UserControl

public static event Helper.CompanyCreatedDelegate CompanyCreated;

My (BS, hack!) solution for now is to open the UserControls_CompanyInfo file and

make one small change, like add a space(!) save it and I can complile.

Please help!

Jim

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Friday, April 27, 2007 12:03 PM by Jim C

Can anyone help me with this?

Anyone, I'm desparate!

Thanks

Jim

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Sunday, April 29, 2007 1:46 AM by Jim C

Why did you guys filter out my last comment?

I REALLY need help and that entry created more emphasis!

Thanks a lot.

Jim

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Monday, May 07, 2007 7:37 PM by ScottGu

Hi Jim,

Can you send me an email (scottgu@microsoft.com) with details of the problem?

Thanks,

Scott

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Friday, May 11, 2007 11:29 PM by Anksunamon

Hi,

I have this bug since the bêta 2, and still having it under windows vista with sp1 and the update for windows vista.

As I'm french, I can't install the hotfix...

The command batch=false use to work during a moment, but now this bug comes again.

Will this be really fixed one day?

Because I'm bored to close visual studio and reopen it, changing a few line in a .cs file and the web.config and this don't work everytime...

Thanks in advance.

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Friday, May 18, 2007 2:14 AM by ScottGu

Hi Anksunamon,

Can you send me an email with more details of the behavior you are seeing?  I'll then connect you with product support to have them investigate further.

Thanks,

Scott

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Wednesday, May 23, 2007 10:38 AM by Rich

I'm getting a

Page Not Found

The content that you requested cannot be found or you do not have permission to view it.

for the Hotfix.  I seem to be at least the 3rd person who can't get it.  Do we need a special customer Passport account?

# re: Public Hotfix Patch Available for ASP.NET Compilation Issues

Friday, May 25, 2007 10:42 AM by Manso

FYI, this hotfix is now also available on Vista and I believe PSS should be contacted to get it. Seems to work well so far.

# Public Hotfix Patch Available for VS 2005 F5 Debugging Performance Issue with ASP.NET

Tuesday, August 21, 2007 3:43 AM by ScottGu's Blog

Over the last year we've seen several people report having performance problems when using F5 to run

# Public Hotfix Patch Available for VS 2005 F5 Debugging Performance Issue with ASP.NET

Tuesday, August 21, 2007 4:27 AM by ASP.NET

Over the last year we've seen several people report having performance problems when using F5 to run/debug

# bruno Kenj &raquo; Blog Archive &raquo; Hotfix: performance debug no VS 2005

Pingback from  bruno Kenj  &raquo; Blog Archive   &raquo; Hotfix: performance debug no VS 2005

# Summary of fixes available for ASP.NET 2.0

Friday, September 07, 2007 4:01 AM by Notes from a dark corner

[last update - 31st August 2007 - added 939866,] [previous update - 3rd August 2007 - corrected some

# 【收藏】本周ASP.NET英文技术文章推荐[04/08 - 04/14]

Tuesday, November 27, 2007 3:19 AM by Jacky_xu

本期共有6篇文章: ASP.NET编译问题的公开Hotfix补丁

期待下个版本AjaxPro的发布

在ASP.NET2.0中使用MultiView控件实现多页面表单

数...

# MS Connect &laquo; Syntactic.org

Wednesday, April 09, 2008 4:55 PM by MS Connect « Syntactic.org

Pingback from  MS Connect &laquo; Syntactic.org

# 几个ASP.NET 2.0编译缺陷

Friday, January 23, 2009 10:01 AM by 追梦人RUBY

过去的一年里,我们发现和修补了大家报告遇上的几个ASP.NET2.0编译缺陷。

引发这些缺陷的原因有多个,但根本原因通常跟项目的结构有关,这些项目有特别的跨页面的循环依赖。这些缺陷往往在系统上发生...

# kjempekjekt.com &raquo; Blog Archive &raquo; ASP.NET patch for kompileringsproblemer

Pingback from  kjempekjekt.com  &raquo; Blog Archive   &raquo; ASP.NET patch for kompileringsproblemer

# ASP.NET编译问题的公开Hotfix补丁发布了(转载)

Friday, March 27, 2009 12:13 PM by 薰衣草的旋律

ASP.NET编译问题的公开Hotfix补丁发布了

【原文地址】blog.joycode.com/.../101024.aspx

【英...