none
ClickOnce Deployment Problem

    Question

  • I have a clickonce application that has worked fine in production for over a year. We have successfully had many updates to this app and clickonce has handled them.

    Last week we rolled out a new version. Clickonce downloads the new version fine, but when the app starts
    to run it fails. It does not give an error message, it shows the opening splash screen and just goes away.

    I was able to get the new version to run by clearing the application cache
    (deleting the files in C:\Documents and Settings\xxx\Local Settings\Apps\2.0\)
    Since I have 100+ users this has become quite a hassle. Does anyone know of anything that would cause this
    to happen?

    Tuesday, October 06, 2009 1:22 PM

Answers

  • The old version thing -- I don't know what would cause that. If you are changing something in your database, are you pushing the update as a required update, so the user can't skip it? To do that, look in the Update dialog, and set the minimum version equal to the one you are deploying.

    If that doesn't help, try clearing the ClickOnce cache and reinstalling. To clear the cache, get a copy of mage.exe, copy it to the machine, and run it with the parameter -cc, like this:  $ mage -cc

    mage.exe can be found in the microsoft sdks folder under program files, assuming you've installed any of the windows sdks of vs2008 or vs2005.

    We didn't put a try/catch around the whole application. We subscribe to the UnhandledExceptionEventHandler and the ThreadExceptionEventHandler, and handle them. That way if an exception is thrown that makes the appilcation close, we almost always get a message. If you changed the database format and the user skipped the update, that could explain a lot.
     
    AppDomain adCurrent = AppDomain.CurrentDomain;
    
    adCurrent.UnhandledException += 
    new UnhandledExceptionEventHandler(adCurrent_UnhandledException);
    
    System.Windows.Forms.Application.ThreadException += 
    new ThreadExceptionEventHandler(Application_ThreadException);
    
    then we handle it
    
    static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
    {
        //If you use Application.Exit instead of Environment.Exit, 
        //it leaves the app in the process list.
        
        //you could log it or send yourself an e-mail with the error 
        Environment.Exit(-1);
    
    
    static void adCurrent_UnhandledException(object sender, UnhandledExceptionEventArgs e)
    {
        //Log it or send yourself an e-mail with the error 
        Environment.Exit(-1);
    }

    I don't think your problem is caused by the propagation of .NET 3.5 SP-1 by Microsoft. We have a lot of users all over the world, and haven't had any problems with the versioning. We also push all updates to the public as required so they can't skip it.

    The machines that are having the problem -- are they Vista or XP?


    RobinDotNet
    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    • Marked as answer by Kira Qian Monday, October 12, 2009 6:28 AM
    Thursday, October 08, 2009 6:43 AM

All replies

  • I wouldn't assume this is a ClickOnce problem. Maybe there's something you're caching that is not agreeable with the new version. Also, did you change the versions of any of the 3rd party dll's that are used in the application, or did you just change home-grown code?

    What I would do is test rolling out the first version they had installed, then roll out an update to it that doesn't have any changes except the version number, and if that's okay, roll out the new version. Maybe you can do that to a test URL and have someone who had a problem test it.

    Also, are you catching the unhandled exception error in your application, the one that catches anything you haven't handled? For us, this helped us track down an obscure bug that only appeared on certain XP machines -- rather than just close, the app would show the error.

    Another question is do you have any logging at startup to make sure the app is actually starting up successfully? At the point it's starting up, ClickOnce is no longer involved.

    Is it C# or VB? (Did you write the splash screen yourself, or is it VB where you can just specify it and it will show it) ?

    RobinDotNet
    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    Tuesday, October 06, 2009 8:48 PM
  • Another thing we've discovered is that it seems to be running the old version. The app running on one machine gave an error that it was looking
    for a column that wasn't there. The new code does not use this column anymore.

    We just changed home-grown code VB.net

    We went from version: 2.6.4 to version 3.0.14 so that should not be causing any issues

    I will try rolling out the 2.6.4 version and try replicating this again as you suggest.

    As for error handling in the startup of the application. Do you recommend just putting a TRY-CATCH around the whole startup process and just displaying any errors to the user? Or is there any other way to do that?

    One thing that is odd about this problem is that the new version of my app ran for some machines. But, did not for others. The machines that it fails on seem
    to have had the .net framework 3.5 SP1 installed on them recently. We target the 2.0 framework and the machines that it works on seems to have had 3.5 sp1 installed a while ago.

    Thanks for the help!
    Wednesday, October 07, 2009 2:47 PM
  • We are also facing the similar kind of issue which Nigel Tufnel is facing. Does anybody have the solution or the reason? Please let me know.

    Thanks in advance.
    Wednesday, October 07, 2009 4:58 PM
  • The old version thing -- I don't know what would cause that. If you are changing something in your database, are you pushing the update as a required update, so the user can't skip it? To do that, look in the Update dialog, and set the minimum version equal to the one you are deploying.

    If that doesn't help, try clearing the ClickOnce cache and reinstalling. To clear the cache, get a copy of mage.exe, copy it to the machine, and run it with the parameter -cc, like this:  $ mage -cc

    mage.exe can be found in the microsoft sdks folder under program files, assuming you've installed any of the windows sdks of vs2008 or vs2005.

    We didn't put a try/catch around the whole application. We subscribe to the UnhandledExceptionEventHandler and the ThreadExceptionEventHandler, and handle them. That way if an exception is thrown that makes the appilcation close, we almost always get a message. If you changed the database format and the user skipped the update, that could explain a lot.
     
    AppDomain adCurrent = AppDomain.CurrentDomain;
    
    adCurrent.UnhandledException += 
    new UnhandledExceptionEventHandler(adCurrent_UnhandledException);
    
    System.Windows.Forms.Application.ThreadException += 
    new ThreadExceptionEventHandler(Application_ThreadException);
    
    then we handle it
    
    static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
    {
        //If you use Application.Exit instead of Environment.Exit, 
        //it leaves the app in the process list.
        
        //you could log it or send yourself an e-mail with the error 
        Environment.Exit(-1);
    
    
    static void adCurrent_UnhandledException(object sender, UnhandledExceptionEventArgs e)
    {
        //Log it or send yourself an e-mail with the error 
        Environment.Exit(-1);
    }

    I don't think your problem is caused by the propagation of .NET 3.5 SP-1 by Microsoft. We have a lot of users all over the world, and haven't had any problems with the versioning. We also push all updates to the public as required so they can't skip it.

    The machines that are having the problem -- are they Vista or XP?


    RobinDotNet
    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    • Marked as answer by Kira Qian Monday, October 12, 2009 6:28 AM
    Thursday, October 08, 2009 6:43 AM
  • Thanks for the info on the error handling.

    We run this app as an online application. So users are always running the most current version. We use XP.

    I had a user who was getting application errors, and the app that came up on the screen was the most current version, yet the errors he was
    getting seemed to indicate that he was running code from the previous version. Perhaps it was grabbing the previous versions class library dll or something?

    Thursday, October 08, 2009 12:51 PM
  • I found this thread:
    http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/37e20cec-933a-42a6-b5a2-890ab863b0b4

    which links to this article:
    http://support.microsoft.com/default.aspx/kb/971052

    I am going to do some testing to see if this is what is causing my issue.
    Thursday, October 08, 2009 5:01 PM