The following code runs with no issue in my app using Xojo 2023r3
Public Function ToStringArray(Extends json As JSONItem) As String()
Dim result() As String
If json Is Nil Then Return result
If Not json.IsArray Then Return result
Dim LastItemIndex As Integer = json.Count - 1 // Get exception here with 2023r4 and 2024r1
For i As Integer = 0 To LastItemIndex
result.Append json(i).StringValue
Next
Return result
End Function
However, when my app runs this code using Xojo 2023r4 or 2024r1, I get a TypeMismatchException on the line noted. This occurs when the method’s JSONItem is passed ["Test"]
If I continue and let my app’s Unhandled Exception window catch this I get the following stack info:
RuntimeRaiseException
_Z19RaiseExceptionClassRK13ClassDeclBase
VariantArrayAssignmentWithTypeCheck
JSONItem.LastRowIndex%i8%o<JSONItem>
JSONItem.Count%i8%o<JSONItem>
DBReportShared.$ToStringArray%A1s%o<JSONItem>
DBReportChart.DrawChk%%o<DBReportChart>
If I create a test app using 2023r4 or 2024r1 containing just this method and pass it ["Test"]
there is no issue. Can anyone see why this is happening with my main app or suggest a way to isolate what’s causing the issue?
Testing on macOS 13.6. Thanks
15 posts - 5 participants