question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unhandled exception. System.NullReferenceException

See original GitHub issue

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, Action1 callback, TState& state)` Which leads to the failure of my program.

  • This error does not occur often when the device is reconnected (physically).
  • When it opens often, the port closes.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
jcurlcommented, Feb 4, 2022

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.

0reactions
Muximizecommented, Feb 4, 2022

@ilrom Does 2.4.0 fix your issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I fix the error: System.NullReferenceException
A NullReferenceException exception is thrown when you try to access a member on a type whose value is null. A NullReferenceException exception ...
Read more >
c# - What is a NullReferenceException, and how do I fix it?
The runtime throwing a NullReferenceException always means the same thing: you are trying to use a reference, and the reference is not ......
Read more >
Object Reference Not Set to an Instance of an Object
This exception is thrown when you try to access a member—for instance, a method or a property—on a variable that currently holds a...
Read more >
What is NullReferenceException in C#? - Code Maze
In C#, a NullReferenceException occurs when we try to access a variable whose value has not been set or has been set to...
Read more >
Debugging System.NullReferenceException - elmah.io Blog
The exception happens when you try to invoke a reference that you were expecting to point to an object but in fact, points...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found