Error loading mscorwks.dll that may appear while trying to install a .NET Framework hotfix


I was working with a couple of different customers today who saw a .NET Framework initialization error dialog that says that setup failed to load mscorwks.dll appear when trying to install ASP.NET hotfix KB886903.  The exact error dialog looks like this.

It turns out this is being caused by a race condition that can happen when trying to install one .NET Framework or ASP.NET hotfix immediately after installing another .NET Framework or ASP.NET hotfix.  There is special logic in the .NET Framework hotfix and service pack setup wrapper that is used to rerun ngen.exe to regenerate native images for some of the .NET Framework binaries.  This process is done when installing the .NET Framework, but the native images are invalidated by any changes made to them (such as when they are patched by a service pack).  The process that reruns ngen.exe is separate from the original hotfix installation and in some cases it is scheduled to occur after the next reboot (to account for files in use and things like that).

In both of the scenarios I saw, the customers had installed .NET Framework 1.1 SP1 via Windows Update and then were required to reboot.  After the reboot, the background process was launched by an entry in the RunOnce registry hive and at approximately the same time the setup for the ASP.NET hotfix was launched by Windows Update or Automatic Update.  In some cases, these two processes try to access some of the same resources at the same time and it ends up resulting in an error message.

The end result of this error message is that one or more of the native images fails to be recreated.  This does not cause the .NET Framework to fail in any way, but since ngen.exe is designed to improve performance for the binaries in question, it can lead to performance degradation for the .NET Framework.

If you hit this error and want to make sure that the files will have correct native images generated for them by ngen.exe you can reapply the service pack to cause these commands to be rerun.

 

Comments (23)

  1. D3v says:

    One day i had a power cut while my machine was switched on. I have a surgge protector so that’s ok. Basically though my machine wouldn’t boot due to some system files being corrupted.  I ran the recovery console and managed to fix certain aspects of what had happened by running fixboot and fixmbr as somehow they had become damaged. However i decided to run the repair option rather than fully re-install, to keep my system the way it was from the MCE 2005 cd. Everything installed fine except i received Error loading f:windows2microsoft .netframwork v2.0.50727mscorwks.dll then it told me to check the medctroc.log file. This can bee viewed here > http://phunky-j.djhost.nl/MedCtrOC.log

  2. D3v says:

    any way to fix media center as i can’t even load it at the minute i simply get the ehshell.exe error application has generated an exception that could not be handled

  3. Hi D3V – I think the best route here is to try to reinstall the .NET Framework 2.0 – it sounds like the registry thinks that is still installed but the files might be reverted because of how the OS was repaired.  You can find the .NET Framework 2.0 at http://msdn.microsoft.com/netframework/downloads/updates.  Hope this helps!

  4. D3v says:

    hi aaron,

    ive completely removed and reinstalled the whole .net framework to no avail. i have just downloaded the .net 2.0 SDK and attached the debugger to the program ehshell.exe

    This is what i get:

    An unhandled exception of type ‘System.TypeLoadException’ occurred in Unknown Module.

    Additional information: Method ShowCPRecordingStop in type MediaCenter.Common.TenFootUserXPAdapter from assembly ehshell, Version=6.0.3000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 does not have an implementation.

  5. Hi D3v – It sounds like you might have a mismatch in some of the Media Center binaries on your system.  You mentioned that you have repaired your OS, but you may want to also repair the Media Center bits and/or install the latest Update Rollup for Media Center and see if that will help resolve this issue on your system.

  6. D3v says:

    Thanks for the fast reply btw Aaron!

    I cannot install the latest update it simply fails telling me to contact my hardware vendor. I built my machine lol! How would i go about reparing my media center bits?

  7. Hi D3v – what update are you trying to install in this scenario?  It should be named KB#####.  Can you look for %windir%kb#####.log and see if it tells you in that log file why the update is failing?  That should help you figure out what steps to take next.

  8. D3v says:

    hey again aaron. im trying to install the media centre rollup 2. my log is here http://phunky-j.djhost.nl/KB900325.log

    Thanks

  9. D3v says:

    forgot to add this. here are all my relevent logs http://phunky-j.djhost.nl/mcelogs.zip

  10. D3v says:

    ok all above is now not relevant!!!

    —————————-

    Ok…so what i’ve done now is extracted the update (WindowsXPMediaCenter2005-KB900325-usa.exe) to a folder. I then manually installed all of the hotfixes..except one which is WindowsXP-KB891593-x86.exe (which failed stating that it had failed to migrate dependant packages), even the above hotfix that failed during the automated install (KB900325) installed ok. Weird i have a AMD64 Cpu :/ . Anyway…media centre now run’s, although it now crashes out when i try to close it. I don’t know however, which hotfix actually enabled media centre to run as i didn’t try to run it after every hotfix. My updated log for the failed hotfix WindowsXP-KB891593-x86.exe is here > http://phunky-j.djhost.nl/KB891593.log.

    Once again thanks for your help so far!

  11. D3v says:

    I realise i’m answering my own posts here but i’m getting somewhere so it’s something for us all to learn, i’m just getting sick of rebooting lol.

    After rebooting from the previous post i downloaded Downloading Security Update for Microsoft .NET Framework, Version 1.1 Service Pack 1 (KB886903) (this is simply due to me messing)

    Downloading Update for Windows XP Media Center Edition 2005 (KB910393)

    Downloading Security Update for Windows XP (KB913446)

    Ok. after installing these and rebooting i found KB891593 still wouldnt install. i checked this out and you blog answered the question >

    http://blogs.msdn.com/astebner/archive/2005/10/24/484381.aspx <

    remove KB904706 and then install KB891593. It works fine.

    Then after visiting windows update i needed KB912067. Ok gonna reboot AGAIN and see what happens. Yep i’ll keep ya posted.

  12. D3v says:

    Ok everything works fine, media centre exits ok now and there are no available updates. Never thought i’d manage to fix it but i have. Took me long enough! I’ll be posting my own blog about this (without all the gobbledygook) as along my way i have found a few posts along my way about my initial error of media centre not being able to start with the initial error ‘error application has generated an exception that could not be handled’ but with nobody having a solution…so i hope i helped a few people.

    i can now use my media centre remote again woohoo! Plus i don’t have to use some crappy imitation like nero home…pfft!

  13. Hi D3v – I’m sorry for all of the hassles, but I’m glad to hear that you have gotten your system up and running.  If you don’t mind, can you please post a link to your blog post on my blog comments when you get it written so that other folks who read my blog can find it?

  14. D3v says:

    This is everything reworded so you could delete all the above posts as this now makes sense.

    ——————

    ehshell.exe error application has generated an exception that could not be handled  – FIXED.

    The cause of this on my machine was due to an error loading mscorwks.dll when re-installing MCE 2005, however, I understand that quite a few people have had this error for other reasons. Here’s how I fixed it.

    Basically everything installed fine when I repaired my MCE2005 except I received an error, ‘Error loading f:windows2microsoft .netframework v2.0.50727mscorwks.dll’ then it told me to check the medctroc.log file.

    Apparently this error may also appear when trying to install a .NET Framework hotfix if you  are simply updating windows MCE. I guess my install CD has this slipstreamed.  

    Firstly I tried to reinstall the .NET Framework 2.0 as I thought it sounded like the registry thought that media centre was still installed but the files might be reverted because of how the OS was repaired.  You can find the .NET Framework 2.0 at http://msdn.microsoft.com/netframework/downloads/updates.  However, this did not work for me but it could be one of the solutions for you, so I would try it.  I then installed the .NET 2.0 SDK and attached the debugger to ehshell.exe (media centre).  I received the message ‘An unhandled exception of type ‘System.TypeLoadException’ occurred in Unknown Module’ followed by;

    Additional information: Method ShowCPRecordingStop in type MediaCenter.Common.TenFootUserXPAdapter from assembly ehshell, Version=6.0.3000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 does not have an implementation.

    I tried to update my system via Windows Update with the KB900325 update (Rollup 2 for MCE2005), but it always failed.  NOTE. This update contains other updates, including itself. These are; KB900325.exe, WindowsMedia10-KB895572-x86.exe,  WindowsXP-KB888795-x86.exe, WindowsXP-KB891593-x86.exe, WindowsXP-KB895961-x86.exe, WindowsXP-KB899337-v2-x86.exe, WindowsXP-KB899510-x86.exe, WindowsXP-KB902841-x86.exe, wmfdist95.exe. I then downloaded the update (WindowsXPMediaCenter2005-KB900325-usa.exe) and tried to install it and found that it failed on installing a specific update, which was the kb900325 hotfix. (NOTE that when it fails you will need to reboot and it will do a system restore on your machine. Let it do this BEFORE you carry on with the following.)

    To resolve this I extracted the file WindowsXPMediaCenter2005-KB900325-usa.exe to a folder. I then manually installed all of the hotfix’s individually. Except one which is WindowsXP-KB891593-x86.exe (which failed stating that it had failed to migrate dependant packages), even the above hotfix that failed during the automated install, (KB900325) installed ok. Anyway…media centre now run’s, although it now crashes out when I try to close it, this should be the same case for you too.   I don’t know however, which hotfix actually enabled media centre to run as I didn’t try to run it after every hotfix. You should now reboot your machine and visit Windows Update.  This will then download two updates, KB910393 and KB913446.  Then reboot your machine again.  Now back to the one hotfix that failed earlier, to sort this you will need to go to; Start/run/appwiz.cpl . Make sure the updates box is checked. Scroll down to Windows XP – Software updates. Remove the file KB904706 (it will prompt you that it is not advised as certain files/programs depend on it) and then go back to the folder where you extracted the rollup to and install KB891593, it should now install fine.  You will then need to download  and install the update KB904706 again.  Then go to Windows Update and install the latest update KB912067. Reboot your machine and everything should work fine!

    I personally thought that I’d never manage to fix it but I have.

    I can now use my media centre remote again woohoo! Plus I don’t have to use some crappy imitation like Nero home…pfft!

    I’d like to personally thank Aaron Stebner from Microsoft with his assistance in helping me to solve this problem. You can view his blog which if you haven’t managed to sort your media centre out with my solution, he might have one. His blog is http://blogs.msdn.com/astebner

  15. D3v says:

    Ok Aaron i can’t seem to find ‘Your blog comments section’ so ill post here. Just remove everything previous to this post in this thread.

    The post on my blog is available here > http://mmvr14.blogspot.com/2006/02/ehshellexe-error-application-has.html

    The cause of this on my machine was due to an error loading mscorwks.dll when re-installing MCE 2005, however, I understand that quite a few people have had this error for other reasons. Here’s how I fixed it.

    Basically everything installed fine when I repaired my MCE2005 except I received an error, ‘Error loading f:windows2microsoft .netframework v2.0.50727mscorwks.dll’ then it told me to check the medctroc.log file.

    Apparently this error may also appear when trying to install a .NET Framework hotfix if you  are simply updating windows MCE. I guess my install CD has this slipstreamed.  

    Firstly I tried to reinstall the .NET Framework 2.0 as I thought it sounded like the registry thought that media centre was still installed but the files might be reverted because of how the OS was repaired.  You can find the .NET Framework 2.0 at http://msdn.microsoft.com/netframework/downloads/updates.  However, this did not work for me but it could be one of the solutions for you, so I would try it.  I then installed the .NET 2.0 SDK and attached the debugger to ehshell.exe (media centre).  I received the message ‘An unhandled exception of type ‘System.TypeLoadException’ occurred in Unknown Module’ followed by;

    Additional information: Method ShowCPRecordingStop in type MediaCenter.Common.TenFootUserXPAdapter from assembly ehshell, Version=6.0.3000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 does not have an implementation.

    I tried to update my system via Windows Update with the KB900325 update (Rollup 2 for MCE2005), but it always failed.  NOTE. This update contains other updates, including itself. These are; KB900325.exe, WindowsMedia10-KB895572-x86.exe,  WindowsXP-KB888795-x86.exe, WindowsXP-KB891593-x86.exe, WindowsXP-KB895961-x86.exe, WindowsXP-KB899337-v2-x86.exe, WindowsXP-KB899510-x86.exe, WindowsXP-KB902841-x86.exe, wmfdist95.exe. I then downloaded the update (WindowsXPMediaCenter2005-KB900325-usa.exe) and tried to install it and found that it failed on installing a specific update, which was the kb900325 hotfix. (NOTE that when it fails you will need to reboot and it will do a system restore on your machine. Let it do this BEFORE you carry on with the following.)

    To resolve this I extracted the file WindowsXPMediaCenter2005-KB900325-usa.exe to a folder. I then manually installed all of the hotfix’s individually. Except one which is WindowsXP-KB891593-x86.exe (which failed stating that it had failed to migrate dependant packages), even the above hotfix that failed during the automated install, (KB900325) installed ok. Anyway…media centre now run’s, although it now crashes out when I try to close it, this should be the same case for you too.   I don’t know however, which hotfix actually enabled media centre to run as I didn’t try to run it after every hotfix. You should now reboot your machine and visit Windows Update.  This will then download two updates, KB910393 and KB913446.  Then reboot your machine again.  Now back to the one hotfix that failed earlier, to sort this you will need to go to; Start/run/appwiz.cpl . Make sure the updates box is checked. Scroll down to Windows XP – Software updates. Remove the file KB904706 (it will prompt you that it is not advised as certain files/programs depend on it) and then go back to the folder where you extracted the rollup to and install KB891593, it should now install fine.  You will then need to download  and install the update KB904706 again.  Then go to Windows Update and install the latest update KB912067. Reboot your machine and everything should work fine!

    I personally thought that I’d never manage to fix it but I have.

    I can now use my media centre remote again woohoo! Plus I don’t have to use some crappy imitation like Nero home…pfft!

    I’d like to personally thank Aaron Stebner from Microsoft with his assistance in helping me to solve this problem. You can view his blog which if you haven’t managed to sort your media centre out with my solution, he might have one. His blog is http://blogs.msdn.com/astebner

  16. Hi D3v – thank you for the link back and thank you for posting the detailed steps that you followed to resolve this issue.  Please don’t hesitate to contact me if you run into any further issues in the future.

  17. Glassman says:

    I am a (very) non-technical user that experienced the problems this topic addressed.  I followed these directions and, after several tense moments (during a period in excess of six hours, I might add), I also successfully restored my MCE to (apparent) working order (I hope).  Now I understand that (and check me on this) I should *not* update the .NET Framework beyond 1.1 and no security updates.  When my MCE 2005 refused to work anymore last night, I was at .NET Framework 2.0 and some of the security fixes — I am now forewarned.

    However, the Windows updater now wants me to install the following:

    – Security Update for Microsoft .NET Framework, Version 1.0 Service Pack 3 (KB887998)

    – Security Update for Microsoft .NET Framework, Version 1.1 Service Pack 1 (KB886903)

    – Update for Windows XP Media Center Edition 2005 (KB913800)

    After what I went through into the wee hours of the morning, I am hesitant to "rock the boat" and install *any* .NET Framework or MCE updates!

    Please advise me (1) if I should follow the updater and install these updates, and more importantly, (2) are there ANY updates or "hotfixes" that I should avoid in order for the MCE *not* to crash again?

    Thank you four your time and already valuable assistance in this matter.

    Cordially,

    Steve "The MCE Newbie" Glass

  18. Hi Glassman – I don’t know of any specific bugs that would prevent you from installing the .NET Framework 2.0 on a Windows XP Media Center system.  We have done a lot of testing of this scenario.  There may have been something broken with the .NET Framework on your system that caused this though, but it is hard to say because I’m not sure exactly what was wrong with your Media Center functionality.  Can you clarify what you mean by "refused to work" above?  Did Media Center crash?  Or did it display an error message and close (and if so, what was the exact error)?

    You should be able to safely install all of the updates that you list above.

    If you run into any further issues with Media Center after installing those hotfixes, please contact me using http://blogs.msdn.com/astebner/contact.aspx and I can try to help.

  19. klarry79 says:

    hi there,

    I am running a web application that streams 3d engineering graphics. the application runs on a webpart built on Windows share point services 2.0.

    IIS Worker Process error pops up with the following details:

    Description:

    Faulting application w3wp.exe, version 6.0.3790.1830, stamp 42435be1,

    faulting module mscorwks.dll, version 2.0.50727.42, stamp 4333e7ec, debug?

    0, fault address 0x000e9f96.

    can anyone help resolve this

    thanks

    klarry79

  20. Hi Klarry79 – I haven’t heard of an error like this before, but this kind of IIS/ASP.NET crash is out of my areas of expertise. I’d suggest posting this question on one of the .NET development forums at http://forums.microsoft.com/MSDN/default.aspx?ForumGroupID=12&SiteID=1 and hopefully someone there can suggest some solutions for this scenario.

  21. conwayap says:

    Hey Aaron,

    I’m trying to help my brother; he has a notebook running on Vista Home. He isn’t very savvy with computers, and he doesn’t really install lots of software or play around with any configurations on his machine…

    …but…

    He’s getting the .net initialization error message that points to  c:windows2microsoft .netframwork v2.0.50727mscorwks.dll

    I suppose my question is, will any of the solutions above behave on a Vista machine?

  22. Hi Conwayap – The above solutions will only work for the MSI version of the .NET Framework 2.0.  On Windows Vista, the .NET Framework 2.0 is an OS component and is not installed by using the MSI version.

    You can use steps like the ones at http://blogs.msdn.com/astebner/archive/2007/03/26/how-to-repair-the-net-framework-2-0-and-3-0-on-windows-vista.aspx to verify and repair the files that are a part of the .NET Framework 2.0 on Vista.  However, I’m not sure this error would be caused by missing files.

    I’ve seen this type of initialization error caused by some missing registry values in the past, so I would also suggest that you double check and make sure that your system has the .NET Framework 2.0 registry values listed at http://blogs.msdn.com/astebner/archive/2007/06/12/3260076.aspx.

    If neither of the above help, then the only way I know of to reliably repair the .NET Framework 2.0 on Windows Vista is to repair/re-install Windows Vista itself.

    Also, just to confirm, in the error message you listed below, the folder is named windows2.  Is that where you have Windows installed to on that system?

Skip to main content