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?

# 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 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 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: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

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

# 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 7, 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.