Wednesday, 4 February 2009

Click Once Deployment Problems

I had an interesting problem using click once deployment. When the client started the application the hour glass would appear then disappear without starting the application. The CPU of the PC then went to 100% for some time. Looking at the Task Manager and the running processes there was an application called DW20.exe that was consuming the cpu resources.

Checking first the event log I got entries
EventType clr20r3, P1 preccpclient.exe, P2, P3 496c6e68, P4 preccpclient, P5, P6 496c6e68, P7 3, P8 5c, P9 system.typeloadexception, P10 NIL.

After hunting the internet I found that DW20.exe is a tool that reports microsoft office application crashes. To get a popup window with better error reporting goto the control panel and open System. Under the advanced tab click the button called “Error Reporting” and then Enable error reporting.

Then when the application is started you get the option to debug in Visual studio. The hen we get an error looking like:

System.TypeLoadException was unhandled
Message="Could not load type 'TableStructure' from assembly 'PartnerRe.UTILS.ValueObjects.CatFocusDB, Version=, Culture=neutral, PublicKeyToken=67a0da06f9245dfe'."
at PartnerRe.DOM.CatFocusClientFacade.CatFocusClientFacade.SYS_NO_SPLASH_SCREENFindRecord(String CLIENT_NAME, String& Message)
at PRECCPClient.My.MyApplication.OnInitialize(ReadOnlyCollection`1 commandLineArgs)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at PRECCPClient.My.MyApplication.Main(String[] Args)

In English this means that the application could not find the class TableStructure located in one of the deployed applications.

Uninstalling the application and redeploying the application did not solve the problem. I uninstalled the application and browsed to the location where the click once assemblies where being installed. This is quite a cryptic location, in my case it was
C:\Documents and Settings\nfindlater\Local Settings\Apps\2.0\DT2WB4H4.A65\DKNCBQ6H.MDK

I then deleted all subdirectories and reinstalled the application. This solved the problem. So it turns out that one of the assemblies that was being deployed with the click once application was not being updated. At some point additional functionality in the application required an object called TableStructure. Since the dll containing this function was not being correctly updated the application failed.