Skip to content

Commit 01dc37f

Browse files
committed
Add .NET 6 target
This doesn't unlock any scenarios, but it does allow dropping of the explicit `System.Runtime.CompilerServices.Unsafe` dependency for such programs.
1 parent ae728da commit 01dc37f

6 files changed

+313
-6
lines changed

src/Nerdbank.Streams/FullDuplexStream.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,10 @@ public override Task WriteAsync(byte[] buffer, int offset, int count, Cancellati
143143

144144
public override void WriteByte(byte value) => this.writableStream.WriteByte(value);
145145

146-
public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
146+
public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback? callback, object? state)
147147
=> this.readableStream.BeginRead(buffer, offset, count, callback, state);
148148

149-
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
149+
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback? callback, object? state)
150150
=> this.writableStream.BeginWrite(buffer, offset, count, callback, state);
151151

152152
public override int EndRead(IAsyncResult asyncResult) => this.readableStream.EndRead(asyncResult);

src/Nerdbank.Streams/MultiplexingStream.Channel.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ internal void Dispose(Exception? disposeException)
368368
{
369369
try
370370
{
371-
Channel self = (Channel)state;
371+
Channel self = (Channel)state!;
372372

373373
PipeWriter? mxStreamIOWriter;
374374
lock (self.SyncObject)

src/Nerdbank.Streams/Nerdbank.Streams.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
3+
<TargetFrameworks>net6.0;netstandard2.0;netstandard2.1</TargetFrameworks>
44
<DefineConstants>$(DefineConstants);MESSAGEPACK_INTERNAL;CSHARP8</DefineConstants>
55

66
<Summary>Streams for full duplex in-proc communication, wrap a WebSocket, split a stream into multiple channels, etc.</Summary>
@@ -15,7 +15,7 @@
1515
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" PrivateAssets="all" />
1616
<PackageReference Include="Microsoft.VisualStudio.Validation" />
1717
<PackageReference Include="System.IO.Pipelines" />
18-
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" />
18+
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Condition="'$(TargetFramework)' != 'net6.0'" />
1919
</ItemGroup>
2020
<ItemGroup>
2121
<Compile Update="Strings.Designer.cs">

src/Nerdbank.Streams/Substream.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public override long Position
6464

6565
/// <inheritdoc/>
6666
public
67-
#if NETSTANDARD2_1_OR_GREATER
67+
#if NETSTANDARD2_1_OR_GREATER || NET6_0_OR_GREATER
6868
new // https://github.com/dotnet/csharplang/issues/3613: There's no way to *override* the base method without a binary breaking change from changing the return type on this method.
6969
#endif
7070
Task DisposeAsync() => this.DisposeAsync(CancellationToken.None).AsTask();

0 commit comments

Comments
 (0)