Sessions and WebSessionContext on Xojo

Xojo 2013r1 has a bug in the WebSessionContext object: feedback://showreport?report_id=27067

As a result, you cannot expect the Session function to work and return a WebSession when called in a Web Custom Control event. You can, however, access the session for the event from the control. Simply call: Me.EventSession

Unfortunately this can result in other subtle bugs. For example, calling certain methods on an implicit instance page from a wcc event can result in an exception. Sometimes you can get around this by calling it via Me.EventSession (i.e Me.EventSession.MyPage.DoSomething). Sometimes you have to spin the code off into a WebTimer.

Most of the custom control and demo code makes use of Me.EventSession. However, I did inadvertently use Session in a few places. This will be fixed in the next release, 1.3.1. This should be out by July 1st.

This bug is marked as fixed so there’s a good chance the fix will appear in Xojo 2013r2. If this bug causes you any major headaches, I would recommend using Real Studio 2012r2.1 until I can upload the 1.3.1 fix and/or until Xojo 2013r2 is out.

Update 6/27 – I’m testing a fix that restores the functionality of Session in wcc events, and it seems to be working well. So it looks like 1.3.1 will fully resolve this issue. Again, this is going to be fixed in Xojo any way in release r2, but I don’t want wcc users to have to wait if possible.

Update 7/3 – bad news is that my original work around resulted in a severe performance hit. Good news is that I have another work around with no performance hit. But it’s too late in the evening (um…early in the morning) to finish testing and uploading 1.3.1. I will do this later today.

Leave a Reply

Your email address will not be published. Required fields are marked *