Same, thanks for checking.
Youre welcome. Added same comment on Feedback case.
Chased a couple of “ghosts” where I thought adding a pause, or changing scope of properties/constants or types of variables fixed things, but then itd throw the error again.
Again, same. Bet it turns out to be something simple to workaround it.
I removed the project from my Dropbox as a better one is attached to the Feedback report.
Also moving this to General now.
I rewrote my class around JSONItem_MTC instead so at least my immediate issue has gone away. Hopefully @Joe Ranieri or another engineer can tell what’s going on.
I tested it on a MacBook Pro running 10.12.6
I remember having an issue, which might be related:
If obj IsA Xojo.Core.Dictionary Then // Crashed when obj was Nil
When changing the code to:
If obj Is Nil Then
If obj IsA Xojo.Core.Dictionary Then
… it did not crash anymore. Never happened with any other kind of class, only with Xojo.Core.Dictionary.
Two remarks:
Note that the docs say, that IsA return False for an object is Nil.
Kem, when looking at the project uploaded in Feedback, I notice that you make a lot of assumptions, which used worked
for the classic framework, but do not in the new. For example you do not put Xojo.Core.Dictionary.HasKey and Xojo.Core.Dictionary.Lookup into Try…Catch statements, which IMHO you should. You would have seen that the crash sometimes is a BadDataException which you have not caught. Sometimes there was a different issue which is the above mentioned IsA issue.
Just noticed this thread and see that the report has been verified but not fixed.
This issue only occurs with the Xojo.Core.Dictionary class, not with the classic Dictionary, right?
Correct.
I believe theres a bug in Xojo.Core.Dictionary.Clone.
If you replace both calls to it in the constructor with a custom module method like
Public Function CloneDict(extends dict as Xojo.Core.Dictionary) as Xojo.Core.Dictionary
If dict <> Nil Then
Dim TDict As New Xojo.Core.Dictionary()
For Each e As Xojo.Core.DictionaryEntry In dict
TDict.Value(e.Key) = e.Value
Next
Return TDict
End If
End Function
the project does not crash on my Mac anymore
Without having tried, I’m sure you could subclass the Dictionary and override Clone to achieve the same.
Probably. Was just a quick attempt to fix what I suspected to be the cause.
Maybe your FB case should be renamed to “Xojo.Core.Dictionary.Clones are not retained correctly” or something.