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

39 Comments

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

  • man, glad you had a blog.

  • 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?

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

  • 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!

  • 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?

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

  • 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.

  • 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

  • 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

  • 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

  • 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

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

  • 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.

  • 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

  • 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

  • This is very helpful thanks for the post!

  • 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

  • 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!

  • Thanks Scott!

    Saludos,

  • 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

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

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

  • Thanks for posting about this!
    Hotfix is working great in my case. No problem for close to 2 weeks since the patch.

  • 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.

  • 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

  • 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

  • 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

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

  • Hi Stuart,

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

    1) Add a 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

  • 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

  • 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

  • Can anyone help me with this?
    Anyone, I'm desparate!
    Thanks
    Jim

  • Why did you guys filter out my last comment?
    I REALLY need help and that entry created more emphasis!

    Thanks a lot.

    Jim

  • Hi Jim,

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

    Thanks,

    Scott

  • 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.

  • 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

  • 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?

  • 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.

Comments have been disabled for this content.