# NilObjectException for System.VersionData

**URL:** <https://forum.xojo.com/t/nilobjectexception-for-system-versiondata/73714>\
**Category:** macOS\
**Created:** [December 16, 2022, 12:00pm UTC](https://forum.xojo.com/t/nilobjectexception-for-system-versiondata/73714 "2022-12-16T12:00:08Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Beatrix\_Willius](https://forum.xojo.com/user_avatar/forum.xojo.com/beatrix_willius/32/282_2.png) [@Beatrix\_Willius](https://forum.xojo.com/u/Beatrix_Willius)\
**Post date:** [December 16, 2022, 12:00pm UTC](https://forum.xojo.com/t/nilobjectexception-for-system-versiondata/73714/1 "2022-12-16T12:00:08Z")

</div>

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:

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

```

Of course, my app starts with this code.

Xojo 2022r3

---

<div class="post-metadata">

**Author:** ![Jonathan\_Ashwell](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/c89c15/32.png) [@Jonathan\_Ashwell](https://forum.xojo.com/u/Jonathan_Ashwell)\
**Post date:** [December 16, 2022, 2:26pm UTC](https://forum.xojo.com/t/nilobjectexception-for-system-versiondata/73714/2 "2022-12-16T14:26:45Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Beatrix\_Willius](https://forum.xojo.com/user_avatar/forum.xojo.com/beatrix_willius/32/282_2.png) [@Beatrix\_Willius](https://forum.xojo.com/u/Beatrix_Willius)\
**Post date:** [December 16, 2022, 2:31pm UTC](https://forum.xojo.com/t/nilobjectexception-for-system-versiondata/73714/3 "2022-12-16T14:31:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Beatrix\_Willius](https://forum.xojo.com/user_avatar/forum.xojo.com/beatrix_willius/32/282_2.png) [@Beatrix\_Willius](https://forum.xojo.com/u/Beatrix_Willius)\
**Post date:** [December 16, 2022, 3:11pm UTC](https://forum.xojo.com/t/nilobjectexception-for-system-versiondata/73714/4 "2022-12-16T15:11:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Mike\_D](https://forum.xojo.com/user_avatar/forum.xojo.com/mike_d/32/266_2.png) [@Mike\_D](https://forum.xojo.com/u/Mike_D)\
**Post date:** [December 16, 2022, 3:39pm UTC](https://forum.xojo.com/t/nilobjectexception-for-system-versiondata/73714/5 "2022-12-16T15:39:41Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Beatrix\_Willius](https://forum.xojo.com/user_avatar/forum.xojo.com/beatrix_willius/32/282_2.png) [@Beatrix\_Willius](https://forum.xojo.com/u/Beatrix_Willius)\
**Post date:** [December 16, 2022, 4:25pm UTC](https://forum.xojo.com/t/nilobjectexception-for-system-versiondata/73714/6 "2022-12-16T16:25:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Mike\_D](https://forum.xojo.com/user_avatar/forum.xojo.com/mike_d/32/266_2.png) [@Mike\_D](https://forum.xojo.com/u/Mike_D)\
**Post date:** [December 16, 2022, 6:01pm UTC](https://forum.xojo.com/t/nilobjectexception-for-system-versiondata/73714/7 "2022-12-16T18:01:11Z")

</div>

> [@Beatrix\_Willius](#):
>
> Why do you restart when you switch languages?

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

---

<div class="post-metadata">

**Author:** ![Ian\_Kennedy](https://forum.xojo.com/user_avatar/forum.xojo.com/ian_kennedy/32/6860_2.png) [@Ian\_Kennedy](https://forum.xojo.com/u/Ian_Kennedy)\
**Post date:** [December 16, 2022, 6:07pm UTC](https://forum.xojo.com/t/nilobjectexception-for-system-versiondata/73714/8 "2022-12-16T18:07:32Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Greg\_O](https://forum.xojo.com/user_avatar/forum.xojo.com/greg_o/32/22785_2.png) [@Greg\_O](https://forum.xojo.com/u/Greg_O)\
**Post date:** [December 16, 2022, 7:40pm UTC](https://forum.xojo.com/t/nilobjectexception-for-system-versiondata/73714/9 "2022-12-16T19:40:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Mike\_D](https://forum.xojo.com/user_avatar/forum.xojo.com/mike_d/32/266_2.png) [@Mike\_D](https://forum.xojo.com/u/Mike_D)\
**Post date:** [December 16, 2022, 10:01pm UTC](https://forum.xojo.com/t/nilobjectexception-for-system-versiondata/73714/10 "2022-12-16T22:01:02Z")

</div>

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

 ![image](https://forum.xojo.com/uploads/default/original/2X/f/f539041fed08cb46c3e41d32aa4ac4c92a9af366.jpeg)

![image](https://forum.xojo.com/uploads/default/original/2X/8/86067695c98cd3fc8aa52bc7e2c6deee316a845b.jpeg)

---

<div class="post-metadata">

**Author:** ![Ian\_Kennedy](https://forum.xojo.com/user_avatar/forum.xojo.com/ian_kennedy/32/6860_2.png) [@Ian\_Kennedy](https://forum.xojo.com/u/Ian_Kennedy)\
**Post date:** [December 16, 2022, 10:32pm UTC](https://forum.xojo.com/t/nilobjectexception-for-system-versiondata/73714/11 "2022-12-16T22:32:05Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Mike\_D](https://forum.xojo.com/user_avatar/forum.xojo.com/mike_d/32/266_2.png) [@Mike\_D](https://forum.xojo.com/u/Mike_D)\
**Post date:** [December 16, 2022, 10:45pm UTC](https://forum.xojo.com/t/nilobjectexception-for-system-versiondata/73714/12 "2022-12-16T22:45:57Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![Ian\_Kennedy](https://forum.xojo.com/user_avatar/forum.xojo.com/ian_kennedy/32/6860_2.png) [@Ian\_Kennedy](https://forum.xojo.com/u/Ian_Kennedy)\
**Post date:** [December 16, 2022, 11:01pm UTC](https://forum.xojo.com/t/nilobjectexception-for-system-versiondata/73714/13 "2022-12-16T23:01:32Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Beatrix\_Willius](https://forum.xojo.com/user_avatar/forum.xojo.com/beatrix_willius/32/282_2.png) [@Beatrix\_Willius](https://forum.xojo.com/u/Beatrix_Willius)\
**Post date:** [December 17, 2022, 5:45am UTC](https://forum.xojo.com/t/nilobjectexception-for-system-versiondata/73714/14 "2022-12-17T05:45:51Z")

</div>

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:

 ![Screenshot 2022-12-17 at 06.41.33](https://forum.xojo.com/uploads/default/original/2X/5/54b9300b33cf7ef5a680f35a927ef9cc59a3f128.jpeg)

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

---

<div class="post-metadata">

**Author:** ![Beatrix\_Willius](https://forum.xojo.com/user_avatar/forum.xojo.com/beatrix_willius/32/282_2.png) [@Beatrix\_Willius](https://forum.xojo.com/u/Beatrix_Willius)\
**Post date:** [December 17, 2022, 9:53am UTC](https://forum.xojo.com/t/nilobjectexception-for-system-versiondata/73714/15 "2022-12-17T09:53:15Z")

</div>

2022r4 makes an OutOfBoundsException. Clbuttic!

---

<div class="post-metadata">

**Author:** ![Thomas\_Roemert](https://forum.xojo.com/user_avatar/forum.xojo.com/thomas_roemert/32/827_2.png) [@Thomas\_Roemert](https://forum.xojo.com/u/Thomas_Roemert)\
**Post date:** [December 17, 2022, 1:13pm UTC](https://forum.xojo.com/t/nilobjectexception-for-system-versiondata/73714/16 "2022-12-17T13:13:59Z")

</div>

Hmmm… here everythings works fine: Ventiuar 13.2 Beta 2, Xojo 2022R4, german system.  
 ![Bildschirm­foto 2022-12-17 um 14.10.16](https://forum.xojo.com/uploads/default/original/2X/1/1ae3b8b974f06d9da5b224874cdd5cb435d9fc0e.png)

---

<div class="post-metadata">

**Author:** ![Mike\_D](https://forum.xojo.com/user_avatar/forum.xojo.com/mike_d/32/266_2.png) [@Mike\_D](https://forum.xojo.com/u/Mike_D)\
**Post date:** [December 17, 2022, 3:13pm UTC](https://forum.xojo.com/t/nilobjectexception-for-system-versiondata/73714/17 "2022-12-17T15:13:55Z")

</div>

@Beatrix_Willius  
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?

---

<div class="post-metadata">

**Author:** ![Beatrix\_Willius](https://forum.xojo.com/user_avatar/forum.xojo.com/beatrix_willius/32/282_2.png) [@Beatrix\_Willius](https://forum.xojo.com/u/Beatrix_Willius)\
**Post date:** [December 17, 2022, 4:27pm UTC](https://forum.xojo.com/t/nilobjectexception-for-system-versiondata/73714/18 "2022-12-17T16:27:28Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![Rick\_Araujo](https://forum.xojo.com/user_avatar/forum.xojo.com/rick_araujo/32/251_2.png) [@Rick\_Araujo](https://forum.xojo.com/u/Rick_Araujo)\
**Post date:** [December 17, 2022, 4:38pm UTC](https://forum.xojo.com/t/nilobjectexception-for-system-versiondata/73714/19 "2022-12-17T16:38:06Z")

</div>

> [@Beatrix\_Willius](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![Jeremie\_L](https://forum.xojo.com/user_avatar/forum.xojo.com/jeremie_l/32/150_2.png) [@Jeremie\_L](https://forum.xojo.com/u/Jeremie_L)\
**Post date:** [December 17, 2022, 9:05pm UTC](https://forum.xojo.com/t/nilobjectexception-for-system-versiondata/73714/20 "2022-12-17T21:05:45Z")

</div>

Looks like this is the exact same issue I reported 3 weeks ago for iOS.  
[https://tracker.xojo.com/xojoinc/xojo/-/issues/70979](https://tracker.xojo.com/xojoinc/xojo/-/issues/70979)

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

[Next page](https://forum.xojo.com/t/nilobjectexception-for-system-versiondata/73714.md?page=2)
