-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Override memory-based ReadAsync & WriteAsync for SerialStream #56866
Conversation
Tagging subscribers to this area: @dotnet/area-system-io |
Seems to also contribute to #54916 |
src/libraries/System.IO.Ports/src/System/IO/Ports/SerialStream.cs
Outdated
Show resolved
Hide resolved
@@ -10,9 +10,6 @@ | |||
|
|||
namespace System.IO.Ports | |||
{ | |||
// Issue https://github.com/dotnet/runtime/issues/54916 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about the Windows part? I know it's very archaic, but it seems that the implementation uses ReadFile
and WriteFile
methods, which means that we could just create a FileStream
(with buffering disabled by passing bufferSize: 1
) from the SafeFileHandle
we get in
runtime/src/libraries/System.IO.Ports/src/System/IO/Ports/SerialStream.Win32.cs
Lines 11 to 13 in 6fc8441
public SafeFileHandle OpenPort(uint portNumber) | |
{ | |
return Interop.Kernel32.CreateFile( |
FileStream
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll take a look, but it feels like a separate PR to me..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you @i3arnon !
Contributes to #54575