mirror of
https://github.com/FabInfra/capnproto-dotnetcore_Runtime.git
synced 2025-03-12 14:51:41 +01:00
Troubleshooting ReleaseOnCancelClient
This commit is contained in:
parent
e6c129b8da
commit
0140f21cc4
@ -23,6 +23,7 @@ namespace Capnp.Rpc
|
||||
// In order to distinguish state A from C, the member _refCount stores the reference count *plus one*.
|
||||
// Value 0 has the special meaning of being in state C.
|
||||
int _refCount = 1;
|
||||
string _disposerStackTrace;
|
||||
|
||||
~RefCountingCapability()
|
||||
{
|
||||
@ -68,7 +69,7 @@ namespace Capnp.Rpc
|
||||
{
|
||||
if (Interlocked.Increment(ref _refCount) <= 1)
|
||||
{
|
||||
throw new ObjectDisposedException(nameof(ConsumedCapability));
|
||||
throw new ObjectDisposedException(nameof(ConsumedCapability), _disposerStackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,6 +77,8 @@ namespace Capnp.Rpc
|
||||
{
|
||||
if (1 >= Interlocked.Decrement(ref _refCount))
|
||||
{
|
||||
_disposerStackTrace = Environment.StackTrace;
|
||||
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user