Online reference for App.CurrentThread example

In the online reference for App.CurrentThread it gives the following example:

Dim t As Thread = App.CurrentThread If t <> Nil Then MsgBox("The Thread ID is " + Str( t.ThreadID )) 'UI error here? Else MsgBox("The thread is the main thread") End If

Surely if t <> nil it means we’re currently in a thread, so doing a MsgBox(…) will give a UIExceptionError. Am I not mistaken?

yes, but in console msgbox is just print, so it will work.
And for web app the msgbox also works in threads.

Thank you @Christian Schmitz . Then it’s only bad advice for desktop apps!