More troubleshooting

This commit is contained in:
Christian Köllner 2019-08-25 18:16:01 +02:00
parent 198f778d65
commit 8b2be28eb0

View File

@ -31,22 +31,24 @@ namespace Capnp.Rpc
var rtask = AwaitAnswer(); var rtask = AwaitAnswer();
try
{
// Really weird: We'd expect AwaitAnswer() to initialize a new Task instance upon each invocation. // 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 // 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 (um, really? doesn't make sense. But the // that the underlying implementation recycles Task instances (um, really? doesn't make sense. But the
// obsevation doesn't make sense, either). // observation doesn't make sense, either).
try
{
_taskTable.Add(rtask, promise); _taskTable.Add(rtask, promise);
} }
catch (ArgumentException) catch (ArgumentException)
{ {
// Force .NET to create a new Task instance // Force .NET to create a new Task instance
var stask = rtask;
async Task<T> AwaitAgain() async Task<T> AwaitAgain()
{ {
return await rtask; return await stask;
} }
rtask = AwaitAgain(); rtask = AwaitAgain();