StrataFrame Forum

RBS Interferes with AppLifeUpdate

http://forum.strataframe.net/Topic32536.aspx

By Larry Caylor - 5/5/2014

I thought I’d post this just in case someone else runs thesame issue. Our shop uses AppLifeUpdate with a custom login form to update ourWindows applications. We had been doing so for a long time but recently updateson our Windows XP machines began to abort with an unhandled exception.  Debug showed that AppLifeUpdatehad failed to close the host application. After some more trouble shooting Ifound that StrataFrame sessionlock is somehow interfering with AppLifeUpdate’sability to close the host application. I’m not sure if it started with SF1.7.7.1 or some Windows update. In any event stopping session monitoring priorto performing an update fixes the problem and session monitoring can then berestarted after the update. On Windows 7 machines leaving session monitoringactive during an update sometimes results in application terminated abnormally messages,but the update continues after closing the error message windows. Turing offsession monitoring eliminates the error messages. I didn’t do any additionaltrouble shooting to try and find the root cause but the environment was VS2010,VB .Net targeting the 4.0 framework, SF1.7.7.1, and AppLifeUpdate 5.0, Windows XP SP3 32-Bit and Windows 7 SP1 64-Bit.

-Larry

By Edhy Rijo - 5/5/2014

Hi Larry,

Thanks for sharing this information.  I have been having sort of the same issue but only with my applications being updated on Windows Server 2012R2.  I don't think I have any customer using Windows XP, so did not worry too much.

I use .Net 4.5, VB and SF 1.7.7.1 with VS2013.  I will try your suggestion in the next week or so which I need to release an update and see if that fix the issue on Windows Server 2012 R2.

Thanks again!!!
By StrataFrame Team - 5/7/2014

Good info, Larry, thanks.  We add a low-level windows message hook into the application to detect any mouse movement or keyboard input in order to reset the session inactivity timer.  It's possible that there was some sort of message we handled incorrectly or something else about that hook that's killing the application when you try to update it.
By Edhy Rijo - 10/18/2014

Hi Larry,

I tried your solution, but still on some Windows 2012R2 I keep getting issues with the application not shutting down properly.

Where specifically are you putting that code? 

I have 2 places where an AppLifeUpdate can be done in my applications:
  1. In my main form, I have an UpdateController instance and I am stopping the session monitoring in the Updatestarting() event.
  2. In AppMain.vb I have a method that will instantiate a new UpdateController and if an update is found I am stopping the session monitoring.


Code in AppMain.vb:

'-------------------------------------------------------------------------------
'-- Check if there is an update available for the application.
'-------------------------------------------------------------------------------
With UpdateController
Try
frmSplashScreen.SetMessage("Please wait, checking for updates...")
      If .CheckForUpdate() Then
         '-- 5/6/2014: There is an issue reported by Larry Caylor at the SF forum in which he discovered that AppLifeUpdate could not closed
         '   the application properly before applying an update.
         '   http://forum.strataframe.net/FindPost32536.aspx
         SessionLock.StopSessionMonitoring()
         frmSplashScreen.HideSplash()
         UpdateController.UpdateInteractive()
    Else
        Basics.DisplayMessage("Application Version Error""Sorry no update was found, please contact Progytech at www.progytech.com")
    End If
    Catch DownloadEx As Kjs.AppLife.Update.Controller.DownloadException
        SendErrorMessageViaEmail(DownloadEx)
    Catch ex As Exception
        SendErrorMessageViaEmail(ex)
    End Try
End With




Private Sub UpdateController1_UpdateStarting(sender As Object, e As Kjs.AppLife.Update.Controller.UpdateStartingEventArgsHandles UpdateController1.UpdateStarting
     If (Not e.IsInitiatingController) Then
         '-- 5/6/2014: There is an issue reported by Larry Caylor at the SF forum in which he discovered that AppLifeUpdate could not closed
         '   the application properly before applying an update.
         '   http://forum.strataframe.net/FindPost32536.aspx
         SessionLock.StopSessionMonitoring()
    End If
End Sub

By Ivan George Borges - 10/19/2014

Hi Edhy.

See if this one has anything to do with it:

http://forum.strataframe.net/FindPost31637.aspx

Abraços.

Ivan
By Edhy Rijo - 10/19/2014

Hi Ivan,

Thanks a lot for sharing this, definitely this solved my issue.
Adding this code to stop the Session Monitoring right after the RunApplication line in your AppMain.vb / Program.cs fixed.

        '-- Run the application
        StrataFrameApplication.RunApplication()

        '-- stop SessionLock Monitoring to avoid error on exit on Windows 8
        SessionLock.StopSessionMonitoring()
By Ivan George Borges - 10/20/2014

Glad it helped, Edhy! Cool
By Larry Caylor - 10/20/2014

Hi Edhy

Just saw your post and glad you got it working. My applications use a custom login form where I've added the AppLife code.  I shut down session lock before displaying the login form and start it back up in the load event of my main form.  


-Larry

 
By Edhy Rijo - 10/20/2014

Hi Larry,

Larry Caylor (10/20/2014)
My applications use a custom login form where I've added the AppLife code.  I shut down session lock before displaying the login form and start it back up in the load event of my main form.


Thanks for the explanation.  I also use a custom login, but I handle updates in 2 places:
  1. In the AppMain.vb which has logic to check for update prior to allow anybody to login, this way if one workstation has updated, then all other must be updated to the same version to avoid issues with data structure changes, etc.
  2. In the Main form where it will allow users to check for update and install the update at will.
In any case stopping the session monitoring in the AppMain.vb as suggested by Ivan fix the issue.  I only seen this issue in Windows Server 2012R2 not in Windows 8.1, but at any rate, I am glad it is fixed.
By Larry Caylor - 10/20/2014

Edhy,

It's funny, the post Ivan referred you to didn't solve my AppLife issue. I've had that piece of code in place for years since I had run into a similar issue http://forum.strataframe.net/Topic4465.aspx?Keywords=exit#bm4570. In my environment I had to shut down session lock prior to executing the AppLife code that shuts down the application.

 -Larry
By Edhy Rijo - 10/20/2014

Larry,

I believe in my case, since it only happened with Windows Server 2012R2 which is basically the same kernel as Win 8.1, that I was bite by the two issues, closing the application normally and also when AppLife Update applied an update, so having the code to cover both situation is working for me so far.