Thanks, I investigated this against my current main branch.
The fix I mentioned earlier covered a VM peephole optimisation for module/global variables, and the regression test for that path still passes.
I can reproduce your exact runtime message, but only when the shared MemoryBlock is still Nothing at the point it is indexed. For example:
Shared Property _charInfoTable As MemoryBlock
Shared Function IsWhitespace(codePoint As Integer) As Boolean
Return _charInfoTable[codePoint] = Integer(CharacterType.Whitespace)
End Function
If _charInfoTable has not been assigned a New MemoryBlock(...) before IsWhitespace runs, the VM currently reports:
TypeMismatchException: Only arrays, dictionaries, and indexable objects support indexing.
That message is misleading in this case. It should probably say that you are trying to index Nothing.
I could not reproduce a failure when the shared table is initialised before use. These both work locally:
- initialise
_charInfoTable in App.Constructor
- initialise
_charInfoTable in App.Run before calling IsWhitespace
Could you share the small section where _charInfoTable is declared and initialised, plus where IsWhitespace is first called? In particular I want to check whether the initialisation code definitely runs before the first lookup. If it does, then there is still another bug here and I’ll need that exact shape to reproduce it.