Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > system.typeloadexception on launch: multiple versions of the same application installed
 

system.typeloadexception on launch: multiple versions of the same application installed

This error is sporadic. Some of our users have two versions of our .net application installed (QA build vs Prod build). Each deployment has its own manifest and deployment location etc. Sometimes, but not frequently, a user will get a system.typeloadexception on launch after a new deployment, preventing them from using the app. The only way to fix is to uninstall the other version of the application and then reinstall. Most of the time the two applications can run side by side on the same machine with no problem.

Can anybody shed some light on this problem?


ahops
ahops  Tuesday, August 25, 2009 6:44 PM
It looks like there's some overlap somewhere and some part of one app is loading an assembly from the other. Do you have any assemblies in the GAC? Interop assemblies?

Phil Wilson
PhilWilson  Tuesday, August 25, 2009 6:55 PM
GAC no, but interop yes. Interop.ActiveDS is referenced.

Do you have any idea what would cause one app to load an assembly from another deployment?
ahops
ahops  Tuesday, August 25, 2009 7:04 PM
Hello ahops,

Thanks for your feedback.

The System.TypeLoadException exception indicate thatthe common language runtime cannot find the assembly or the type within the assembly, or cannot load the type. You can try to use the Assembly Binding Log Viewer (Fuslogvw.exe) to checkif the assemblyis loaded correctly with the right version.

http://msdn.microsoft.com/en-us/library/e74a18c4.aspx

Thanks,
Rong-Chun Zhang
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg@microsoft.com


Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Rong-Chun Zhang  Wednesday, August 26, 2009 7:36 AM
Thank you for your suggestion. Let me see if I understand: I need to install the .net SDK tools on a deploy machine and wait for the problem to occur, then check the log. Unfortunately, since I cannot reliably reproduce the issue it could be a frustrating wait.

In the mean time, is there anything else I should know? PhilWilson asked me about GAC and interop assemblies, should I avoid referencing interop assemblies when using clickonce?
ahops
ahops  Wednesday, August 26, 2009 12:43 PM
I have another installation throwing the exception, but I don't see anything in the log viewer. I must be doing something wrong.

The multiple installations of the same application may have been a red herring. The latest installation showing this error does not have multiple applications installed.

To troubleshoot, I navigate to the Local Settings\Apps\2.0\xxxxx\xxxxx\ directory and sort by modified date descending. I open the newest and observe many of the dlls show a modified date that is far older than it should be indicating that clickonce did not download the latest version.

My question is, how do I debug this. Without knowing the internals of clickonce, how can I determine why SOME installations believe that a dll is unchanged, and does not need to be downloaded while others correctly pull all of the changed dlls?


ahops
ahops  Wednesday, August 26, 2009 9:04 PM
Hello ahops,

Thanks for your feedback.

If we work with the Inerop assembly, generally the COM component needs to be registered on the client. To avoid register the COM object globally, we can also use a registry free COM. This feature only works on Windows XP & newer client OSes. Please check

http://windowsclient.net/blogs/faqs/archive/2004/06/11/can-i-use-com-components-built-with-mfc-or-vb6-in-my-clickonce-application.aspx

If you don want to use Assembly Binding Log Viewer (Fuslogvw.exe) tool, you can also try with the Dependency Walker tool, you can open the executable in the Dependency Walker tool and start profiling to see where the error throws.

http://www.dependencywalker.com/

Thanks,
Rong-Chun Zhang
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg@microsoft.com

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Rong-Chun Zhang  Friday, August 28, 2009 10:03 AM

Hello ahops,

I am writing to check the status of the issue on your side. Would you mind letting me know the result of the suggestions? If you have any additional question, welcome to post here.

Have a great day!

Thanks,
Rong-Chun Zhang


Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Rong-Chun Zhang  Tuesday, September 01, 2009 5:37 AM
The issue is still unresolved and our only workaround is to uninstall and reinstall when the error comes up. Addressing the above suggestions:

1. The only interop assembly referenced by our application is interop.activeds. Correct me if I'm wrong, but activeds is a registered component on all windows xp+ systems. Besides, I have no reason to think that this is the source of my problem.

2. A TypeLoadException is being thrown randomly - on random machines and for random types. In other words, one machine will throw the exception looking for one type and another will throw it for a different type and a third will not throw it at all. The types that it is looking for are from my .net assemblies, not interop, not com.

To troubleshoot, I navigate to the Local Settings\Apps\2.0\xxxxx\xxxxx\ directory and sort by modified date descending. I open the newest and observe many of the dlls show a modified date that is far older than it should be indicating that clickonce did not download the latest version. This is where I am stuck.

Thank you for your help.
ahops
ahops  Tuesday, September 01, 2009 12:44 PM
Hello ahops,

I am not sure what is the cause of the issue since I cannot repro it on my side. As a suggestion, you can try to use ClickOnce deploymeng API to manaully downloadall these assemblies , in another word, forcing todownload these assemblies.

http://msdn.microsoft.com/en-us/library/ms228997.aspx

Let me know if that works.

Thanks,
Rong-Chun Zhang
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Rong-Chun Zhang  Friday, September 04, 2009 9:26 AM

Hello ahops,

I am writing to check the status of the issue on your side. Would you mind letting me know the result of the suggestions? If you have any additional question, welcome to post here.

Have a great day!

Thanks,
Rong-Chun Zhang


Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Rong-Chun Zhang  Tuesday, September 08, 2009 10:13 AM

You can use google to search for other answers

Custom Search

More Threads

• Is .Net Framework a must on clientside?
• Installer cutom action?
• .Net Application Updater Component
• A problem about Framework install process control
• Create Localized MSI using Setup and Deployment project in Visual Studio 2008
• file detection during an install VS 2005 .NET
• URLDownloadToCacheFile error when trying to clickonce install
• No access to Add/Remove programs??
• Setup Project, Deployment information, resources
• word2pdf application run only on system installed with Office 2007