Skip to content

Commit 8079cf4

Browse files
authored
Fix ReceivedBytesThreshold (#87)
1 parent 483918e commit 8079cf4

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

System.IO.Ports/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
////////////////////////////////////////////////////////////////
1414
// update this whenever the native assembly signature changes //
15-
[assembly: AssemblyNativeVersion("100.1.5.0")]
15+
[assembly: AssemblyNativeVersion("100.1.6.0")]
1616
////////////////////////////////////////////////////////////////
1717

1818
// Setting ComVisible to false makes the types in this assembly not visible

System.IO.Ports/SerialPort.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ public sealed class SerialPort : IDisposable
3232

3333
private int _writeTimeout = Timeout.Infinite;
3434
private int _readTimeout = Timeout.Infinite;
35-
private int _receivedBytesThreshold;
35+
// default threshold is 1
36+
private int _receivedBytesThreshold = 1;
3637
private int _baudRate;
3738
private Handshake _handshake = Handshake.None;
3839
private StopBits _stopBits;
@@ -429,6 +430,7 @@ public int WriteTimeout
429430
/// Gets or sets the number of bytes in the internal input buffer before a <see cref="DataReceived"/>
430431
/// event occurs.
431432
/// </summary>
433+
/// <value>The number of bytes in the internal input buffer before a <see cref="DataReceived"/> event is fired. The default is 1.</value>
432434
/// <exception cref="ArgumentOutOfRangeException">The <see cref="ReceivedBytesThreshold"/> value is less than or equal
433435
/// to zero.</exception>
434436
public int ReceivedBytesThreshold
@@ -437,12 +439,7 @@ public int ReceivedBytesThreshold
437439

438440
set
439441
{
440-
if (value <= 0)
441-
{
442-
throw new ArgumentOutOfRangeException();
443-
}
444-
445-
_receivedBytesThreshold = value;
442+
NativeReceivedBytesThreshold(value);
446443
}
447444
}
448445

@@ -849,6 +846,9 @@ public void Dispose()
849846
[MethodImpl(MethodImplOptions.InternalCall)]
850847
internal static extern string GetDeviceSelector();
851848

849+
[MethodImpl(MethodImplOptions.InternalCall)]
850+
internal extern void NativeReceivedBytesThreshold(int value);
851+
852852
#endregion
853853
}
854854
}

version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
3-
"version": "1.0.6",
3+
"version": "1.0.7",
44
"assemblyVersion": {
55
"precision": "revision"
66
},

0 commit comments

Comments
 (0)