Have you tried creating the memoryblock outside the DataAvailable event and just reafingAll into that memoryblock and doing all the post-processing outside the DataAvailable event? I would perhaps define two global blocks where you store your incoming data and post-processed data, and you have a timer that does the post-processing. That way the DataAvailable event just reads the buffer into your block and then the timer processes it. You could even implement a ring or circular buffer.
You have this but I don’t see where any data read into InByteTemp is copied elsewhere. It goes out of scope at the end of DataAvailable.
I think he was just using the debugger with this.
He could try to see if there is actual a debugger bug:
System.Debuglog EncodeHex(InByteTemp,true)
To see if this outputs in the debug messages panel
I did try making the MemoryBlocks global - no difference.
There is additional code below what I’ve posted where the InByteTemp gets used/copied. I didn’t post it because it’s irrelevant to the problem at hand.
I think he was just using the debugger with this.
He could try to see if there is actual a debugger bug:System.Debuglog EncodeHex(InByteTemp,true)
To see if this outputs in the debug messages panel
I will give that a try and also will try compiling the code to see if the error goes away. I’ve only run this in the debugger so far. Thanks for the tip.