I developed an App for MacOS and Windows, and I want to build an update.
On MacOS, no trouble, everything is working well.
With the last XOJO relase 2025r2.1, I tested my App on Windows and it crashes while starting.
The debugger shows the following error:
Your application crashed due to an access violation. The Debugger may show invalid values. Check the selected line, make corrections, and try again.
> Stack - Main Thread
> Event Loop
If you can take a minute and create a small project that crashes like this, the Xojo team would surely appreciate it. You shouldn’t be able to crash like this using conventional Xojo code.
It seems my issue is not fully resolved, unfortunately…
In fact, when my App is starting, I’m detecting if there is any News to display :
dim w As new wNews
var newsFound As Boolean = w.readXml(progInit)
w.Close
return newsFound
Here is the readXml function:
self.hide()
me.progInit = progInit
Dim file As FolderItem
#if TargetMachO
file = sandBoxFolder.Child("mcnews.xml")
#elseif TargetWin32
file =SpecialFolder.Preferences.child("MacCompta").child("mcnews.xml")
#endif
if (file = nil) then
'close()
return False
else
dim url As String
dim os As String
dim systemVersion As String
#if TargetMacOS then
os = "Mac OS X"
#elseif TargetWin32 then
os = "Windows"
#endif
systemVersion = getSystemVersion()
url = "https://www.mywebsite.ch/news/checknews.php?app="+str(app.majorVersion)+"."+str(app.minorVersion)+"."+str(app.bugVersion)+"&os="+os+"&v="+systemVersion+"&licence="+str(IDForSN(serialNumber))+"&lang="+kLanguageIdentifier+"&output="
url = ReplaceAll(url," ","%20")
if (System.Network.LookupIPAddress("mywebsite.ch")<>"" and socketUpdater.get(url+"xml",file, 5) and file.length>60) then
Dim xml As new XmlDocument
Dim nodeCurrentNews As XmlNode
Dim currentNewsID As Integer
Dim forceNews As Boolean = false
if(file = nil or not file.Exists) then
dim c As new Clipboard
c.Text = url
return false
end if
try
xml.loadXml(file)
xml.PreserveWhitespace = False
nodeCurrentNews = xml.DocumentElement.FirstChild
currentNewsID = val(nodeCurrentNews.Child(0).FirstChild.Value)
forceNews = (val(nodeCurrentNews.Child(1).FirstChild.Value)=1)
Catch e As XmlException
return false
end try
if(showNews(currentNewsID, forceNews)) then
dim s As new HTTPSocket
dim sourceCode As String = DefineEncoding(replaceAll(s.Get(url+"html",90),chr(13),endOfLine), Encodings.UTF8)
Dim f As FolderItem = GetTemporaryFolderItem
HTMLInfos.LoadPage(sourceCode, f)
return true
else
'close()
return False
end if
elseif(not progInit) then
'close()
return False
else
'close()
return False
end if
end if
I finally found that the App crashed when w.Close is called. If I comment this line, everything works properly, and I don’t understand why.
I checked the wNews window and the closing event is not used.