mirror of
https://github.com/FabInfra/capnproto-dotnetcore_Runtime.git
synced 2025-03-12 23:01:44 +01:00
Troubleshooting
This commit is contained in:
parent
0140f21cc4
commit
198f778d65
@ -33,14 +33,26 @@ namespace Capnp.Rpc
|
||||
|
||||
// Really weird: We'd expect AwaitAnswer() to initialize a new Task instance upon each invocation.
|
||||
// However, this does not seem to be always true (as indicated by CI test suite). An explanation might be
|
||||
// that the underlying implementation recycles Task instances. Let's work around it.
|
||||
// that the underlying implementation recycles Task instances (um, really? doesn't make sense. But the
|
||||
// obsevation doesn't make sense, either).
|
||||
|
||||
#if NETSTANDARD2_0
|
||||
_taskTable.Remove(rtask);
|
||||
try
|
||||
{
|
||||
_taskTable.Add(rtask, promise);
|
||||
#else
|
||||
_taskTable.AddOrUpdate(rtask, promise);
|
||||
#endif
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
// Force .NET to create a new Task instance
|
||||
|
||||
async Task<T> AwaitAgain()
|
||||
{
|
||||
return await rtask;
|
||||
}
|
||||
|
||||
rtask = AwaitAgain();
|
||||
|
||||
_taskTable.Add(rtask, promise);
|
||||
}
|
||||
|
||||
return rtask;
|
||||
}
|
||||
|
@ -23,7 +23,6 @@ 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()
|
||||
{
|
||||
@ -37,6 +36,8 @@ namespace Capnp.Rpc
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
_refCount = 0;
|
||||
|
||||
try
|
||||
{
|
||||
ReleaseRemotely();
|
||||
@ -44,8 +45,6 @@ namespace Capnp.Rpc
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
_refCount = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -69,7 +68,7 @@ namespace Capnp.Rpc
|
||||
{
|
||||
if (Interlocked.Increment(ref _refCount) <= 1)
|
||||
{
|
||||
throw new ObjectDisposedException(nameof(ConsumedCapability), _disposerStackTrace);
|
||||
throw new ObjectDisposedException(nameof(ConsumedCapability));
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,8 +76,6 @@ namespace Capnp.Rpc
|
||||
{
|
||||
if (1 >= Interlocked.Decrement(ref _refCount))
|
||||
{
|
||||
_disposerStackTrace = Environment.StackTrace;
|
||||
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
@ -38,10 +38,10 @@ build_script:
|
||||
after_build:
|
||||
# For once the build has completed
|
||||
artifacts:
|
||||
- path: Capnp.Net.Runtime\bin\Debug
|
||||
- path: Capnp.Net.Runtime\bin\Debug\Capnp.Net.Runtime.$(appveyor_build_version).nupkg
|
||||
name: Capnp.Net.Runtime_debug
|
||||
type: NuGetPackage
|
||||
- path: Capnp.Net.Runtime\bin\Release
|
||||
- path: Capnp.Net.Runtime\bin\Release\Capnp.Net.Runtime.$(appveyor_build_version).nupkg
|
||||
name: Capnp.Net.Runtime
|
||||
type: NuGetPackage
|
||||
- path: chocolatey\install\capnpc-csharp-win-x86.$(appveyor_build_version).nupkg
|
||||
|
Loading…
x
Reference in New Issue
Block a user