Skip to content

Commit

Permalink
Add net8.0 target.
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenCleary committed Dec 3, 2023
1 parent 34bfaed commit 61b8102
Show file tree
Hide file tree
Showing 17 changed files with 28 additions and 22 deletions.
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
root = true

[*.cs]
dotnet_diagnostic.CA1008.severity = none # Use None for flags enum value of 0
dotnet_diagnostic.CA1513.severity = none # Use ObjectDisposedException.ThrowIf
dotnet_diagnostic.CA1711.severity = none # Don't name enum with Flags suffix
2 changes: 1 addition & 1 deletion src/Nito.Disposables/AnonymousAsyncDisposable.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if NETSTANDARD2_1
#if !NETSTANDARD1_0 && !NETSTANDARD2_0 && !NET461
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down
2 changes: 1 addition & 1 deletion src/Nito.Disposables/AsyncDisposable.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if NETSTANDARD2_1
#if !NETSTANDARD1_0 && !NETSTANDARD2_0 && !NET461
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down
2 changes: 1 addition & 1 deletion src/Nito.Disposables/AsyncDisposeFlags.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if NETSTANDARD2_1
#if !NETSTANDARD1_0 && !NETSTANDARD2_0 && !NET461
using System;
using System.Collections.Generic;
using System.Text;
Expand Down
2 changes: 1 addition & 1 deletion src/Nito.Disposables/CollectionAsyncDisposable.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if NETSTANDARD2_1
#if !NETSTANDARD1_0 && !NETSTANDARD2_0 && !NET461
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
Expand Down
2 changes: 1 addition & 1 deletion src/Nito.Disposables/DisposableExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if NETSTANDARD2_1
#if !NETSTANDARD1_0 && !NETSTANDARD2_0 && !NET461
using System;
using System.Collections.Generic;
using System.Text;
Expand Down
2 changes: 1 addition & 1 deletion src/Nito.Disposables/IReferenceCountedAsyncDisposable.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if NETSTANDARD2_1
#if !NETSTANDARD1_0 && !NETSTANDARD2_0 && !NET461
using System;

namespace Nito.Disposables;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if NETSTANDARD2_1
#if !NETSTANDARD1_0 && !NETSTANDARD2_0 && !NET461
using System;

namespace Nito.Disposables;
Expand Down
2 changes: 1 addition & 1 deletion src/Nito.Disposables/Internals/BoundAsyncAction.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if NETSTANDARD2_1
#if !NETSTANDARD1_0 && !NETSTANDARD2_0 && !NET461
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if NETSTANDARD2_1
#if !NETSTANDARD1_0 && !NETSTANDARD2_0 && !NET461
using System;
using System.Collections.Generic;
using System.Text;
Expand All @@ -25,7 +25,7 @@ public ReferenceCountedAsyncDisposable(IReferenceCounter referenceCounter)
}

/// <inheritdoc/>
protected override ValueTask DisposeAsync(IReferenceCounter referenceCounter) => (referenceCounter.TryDecrementCount() as IAsyncDisposable)?.DisposeAsync() ?? new ValueTask();
protected override ValueTask DisposeAsync(IReferenceCounter context) => (context.TryDecrementCount() as IAsyncDisposable)?.DisposeAsync() ?? new ValueTask();

T? IReferenceCountedAsyncDisposable<T>.Target => (T?) ReferenceCounter.TryGetTarget();

Expand Down
4 changes: 2 additions & 2 deletions src/Nito.Disposables/Internals/ReferenceCountedDisposable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public ReferenceCountedDisposable(IReferenceCounter referenceCounter)
}

/// <inheritdoc/>
protected override void Dispose(IReferenceCounter referenceCounter) => (referenceCounter.TryDecrementCount() as IDisposable)?.Dispose();
protected override void Dispose(IReferenceCounter context) => (context.TryDecrementCount() as IDisposable)?.Dispose();

T? IReferenceCountedDisposable<T>.Target => (T?) ReferenceCounter.TryGetTarget();

Expand All @@ -30,7 +30,7 @@ IReferenceCountedDisposable<T> IReferenceCountedDisposable<T>.AddReference()
var referenceCounter = ReferenceCounter;
if (!referenceCounter.TryIncrementCount())
throw new ObjectDisposedException(nameof(ReferenceCountedDisposable<T>)); // cannot actually happen
return new ReferenceCountedDisposable<T>(referenceCounter);
return new ReferenceCountedDisposable<T>(referenceCounter);
}

IWeakReferenceCountedDisposable<T> IReferenceCountedDisposable<T>.AddWeakReference() => new WeakReferenceCountedDisposable<T>(ReferenceCounter);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if NETSTANDARD2_1
#if !NETSTANDARD1_0 && !NETSTANDARD2_0 && !NET461
using System;
using System.Collections.Generic;
using System.Text;
Expand Down
2 changes: 1 addition & 1 deletion src/Nito.Disposables/Nito.Disposables.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<Description>IDisposable and IAsyncDisposable helper types.</Description>
<TargetFrameworks>netstandard1.0;netstandard2.0;netstandard2.1;net461</TargetFrameworks>
<TargetFrameworks>netstandard1.0;netstandard2.0;netstandard2.1;net461;net8.0</TargetFrameworks>
<PackageTags>idisposable,iasyncdisposable,disposable</PackageTags>
</PropertyGroup>

Expand Down
10 changes: 5 additions & 5 deletions src/Nito.Disposables/NoopDisposable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Nito.Disposables;
/// A singleton disposable that does nothing when disposed.
/// </summary>
public sealed class NoopDisposable: IDisposable
#if NETSTANDARD2_1
#if !NETSTANDARD1_0 && !NETSTANDARD2_0 && !NET461
, IAsyncDisposable
#endif
{
Expand All @@ -22,11 +22,11 @@ public void Dispose()
{
}

#if NETSTANDARD2_1
#if !NETSTANDARD1_0 && !NETSTANDARD2_0 && !NET461
/// <summary>
/// Does nothing.
/// </summary>
public ValueTask DisposeAsync() => new ValueTask();
/// Does nothing.
/// </summary>
public ValueTask DisposeAsync() => new ValueTask();
#endif

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Nito.Disposables/ReferenceCountedAsyncDisposable.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if NETSTANDARD2_1
#if !NETSTANDARD1_0 && !NETSTANDARD2_0 && !NET461
using System;
using System.Runtime.CompilerServices;
using Nito.Disposables.Internals;
Expand Down
2 changes: 1 addition & 1 deletion src/Nito.Disposables/SingleAsyncDisposable.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if NETSTANDARD2_1
#if !NETSTANDARD1_0 && !NETSTANDARD2_0 && !NET461
using System;
using System.Threading.Tasks;
using Nito.Disposables.Internals;
Expand Down
2 changes: 1 addition & 1 deletion src/Nito.Disposables/SingleNonblockingAsyncDisposable.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if NETSTANDARD2_1
#if !NETSTANDARD1_0 && !NETSTANDARD2_0 && !NET461
using System;
using System.Threading.Tasks;
using Nito.Disposables.Internals;
Expand Down

0 comments on commit 61b8102

Please sign in to comment.