Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ public bool AddRef()
int oldCount = Volatile.Read(ref _count);

// Have we been disposed?
ObjectDisposedException.ThrowIf(oldCount < 0, this);
if (oldCount < 0)
throw new ObjectDisposedException(typeof(T).ToString());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing. We'll want to fix the analyzer/fixer as well to not fire in this case. But that's not pressing and I can do that when I'm back.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll want to fix the analyzer/fixer as well to not fire in this case. But that's not pressing and I can do that when I'm back.

dotnet/roslyn-analyzers#6396


int newCount = checked(oldCount + 1);

Expand Down