Closed ilrom closed 2 years ago
Thank you for the bug report. Can you tell me the version of the nserial, the library from .net, and the run time you are using?
Thanks for the quick response SerialPortStream Version="2.3.1" run time 3.1.17
I've just posted version 2.4.0 which has changes for handling exceptions in the callbacks. Perhaps this fixes your problem?
If the problem persists, you'll need to enable logging (e.g. console logging), and inject that logger into the SerialPortStream
constructor.
Thanks, I will test and answer whether it helped me.
@ilrom Does 2.4.0 fix your issue?
I analysed the code again, and the problem should not occur with 2.4.0. The callback for the handling of events has now a try/catch block (which would cause .NET Core program to exit, instead of causing an exception).
I'll leave this ticket open for a few days, otherwise I'll close it as fixed in 2.4.0 which is now a NuGet package for a month or so.
I use the library, an error occurs only on Linux machines
Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object. at RJCP.IO.Ports.Native.SerialBuffer.RJCP.IO.Ports.Native.ISerialBufferStreamData.get_BytesToRead() at RJCP.IO.Ports.SerialPortStream.HandleEvent(Object state) at System.Threading.QueueUserWorkItemCallback.<>c.<.cctor>b__6_0(QueueUserWorkItemCallback quwi) at System.Threading.ExecutionContext.RunForThreadPoolUnsafe[TState](ExecutionContext executionContext, Action
1 callback, TState& state)` Which leads to the failure of my program.