NilObjectException for System.VersionData

Does anyone have the latest beta for 13.2 installed? I’ve just got a report from a user with a NilObjectException for the following code:

dim theVersion as System.VersionData = System.Version
LogItem "System: " + theVersion.ToString

Of course, my app starts with this code.

Xojo 2022r3

What is the user’s system language? This sounds like a beta bug I filed where you’d get a nil error when using System.Version in Asian macOS’s (in particular I had several Japanese users report this, which I was able to reproduce, pre-Ventura). It was fixed in the final release (I can’t find my report in Issues unfortunately). if he’s using an Asian language ask him to switch to English – if that fixes it it’s the same bug and updating to 2022r3.2 or r4 should fix it. If this isn’t the issue you can try the comparable MBS method, which has always worked for me.

I’ve already switched to MBS and the user reported that the app is now running fine.

The user is German and I think that he uses the German language on his computer.

I’ve confirmed that the language of the user is German. So it’s a new bug. Gotta install the latest wonderful Ventura beta over the weekend.

I just ran some tests, using both an x64 (Intel) and Universal build, built with Xojo 2022r4, tested with English and again with German as the primary language, restarting between the language switch.

  • Ventura 13.1 : no prolems
  • Ventura 13.2 beta (22D5027d) : no problems.

Can you test with Xojo 2022r4 ?

Edit to add: these tests were on a M1 mac. I don’t have Ventura 13.2 on an Intel mac right now. What kind of mac was your user using?

The user has an M1 Mac. Why do you restart when you switch languages?

macOS suggests you Restart because “Some applications may not use the new language until you restart”

I’ve always taken that to mean to restart the application, which has always worked for me. I suppose if an application had background tasks that were always loaded that could require a full restart.

Just FYI, you don’t need to create the intermediate class. It’s cached behind the scenes.

It’s definitely “restart the computer” not “restart the app”:


1 Like

I’ve certainly never had to do that with Xojo apps. I simply drag the language I want to the top of the list and don’t even close the system preferences window. Run my app and all works fine.

@Ian_Kennedy - I suspect you are right, that if your app is “simple” (e.g. doesn’t use LaunchItems or helper apps or other long-running processes) then your method is perfectly fine.

You can even get away with helper apps if they are launched and controlled by the main app. Before workers came around we used the same trick to achieve multi-core processing of vast datasets that could end up running for days or weeks. So long as that is the model language isn’t an issue.

The basic principal is that the app only reads at startup, so long as everything “starts up” after you change the language you’re fine.

I need to do screenshots now and then for System Preferences/Settings. In this case I say no to restart and quit/restart the System Settings and that is usually enough.

Since Crapolina it has been possible to switch single apps:

Why can’t @Mike_D reproduce the behaviour? Very odd. I’ll try with 2022r4 next.

2022r4 makes an OutOfBoundsException. Clbuttic!

Hmmm… here everythings works fine: Ventiuar 13.2 Beta 2, Xojo 2022R4, german system.
Bildschirm­foto 2022-12-17 um 14.10.16

1 Like

Are you saying that in 2022r3 it’s a NilObjectException and in 2022r4 it’s an OutofBoundsException? That’s odd.

Are you sure that’s where the Exception is happening? Could it be in code a few lines further on in that same event?

@Mike_D : yup, that’s really odd.

I made my customer an example where

MessageBox System.Version.ToString

is the only line of code. So I’m quite sure that this is the offending code.

You need to inspect such machine, OS, processor and regional settings.

I usually use AnyDesk to see “live” inexplicable things on remote machines. Sometimes users made something unusual and got unexpected results, sometimes it is just a new Xojo locale bug being found.

Looks like this is the exact same issue I reported 3 weeks ago for iOS.

It is fixed in Xojo 2022r4, let’s hope it also fixes the issue in macOS 13.2 beta with the fast security update.