SerialPort turns stale if device is unplugged on linux
- Dominant language
- C#
- Stars
- 18.3k
- Forks
- 5.6k
- PR merge metrics
- PR metrics pending
Description
### Describe the bug
When a serial device is replugged on linux the device node is recreated (doubly so for dynamic device nodes/links created by udev rules). When pointing the SerialPort at such a link and replugging the device the SerialPort class does not notice that its using a stale handle, future communication fails though writes/reads simply return no info. The port still reports that its open
### To Reproduce
1. Use Linux
2. Attach a serial device
3. Create a serialport for the device
4. Verify that you can write and read from the device and that the serialport reports that its open
5. Unplug the device
6. Verify that Serialport still reports that its open but that reads and writes now go into the void but no exceptions are logged
### Exceptions (if any)
None
### Further technical details
details of dotnet --info
.NET SDK:
Version: 10.0.100
Commit: b0f34d51fc
Workload version: 10.0.100-manifests.4c0ca8ba
MSBuild version: 18.0.2+b0f34d51f
Runtime Environment:
OS Name: debian
OS Version: 12
OS Platform: Linux
RID: linux-x64
Base Path: /usr/share/dotnet/sdk/10.0.100/
.NET workloads installed:
There are no installed workloads to display.
Configured to use workload sets when installing new manifests.
No workload sets are installed. Run "dotnet workload restore" to install a workload set.
Host:
Version: 10.0.0
Architecture: x64
Commit: b0f34d51fc
.NET SDKs installed:
9.0.307 [/usr/share/dotnet/sdk]
10.0.100 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 9.0.11 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.22 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.11 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Contributor guide
Assessment
This issue has not been assessed yet.