monotorrent: System.InvalidOperationException: A result has already been set on this object

Some times this exception thrown for ReusableTaskMethodBuilder.SetResult() method

11-15 03:35:58.806 E/mono-rt (12699): [ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidOperationException: A result has already been set on this object
11-15 03:35:58.806 E/mono-rt (12699):   at System.Runtime.CompilerServices.ResultHolder`1[T].SetResult (T result) [0x00009] in <52a2eb53628f449d8fde5eb3d5b1035d>:0 
11-15 03:35:58.806 E/mono-rt (12699):   at System.Runtime.CompilerServices.ReusableTaskMethodBuilder.SetResult () [0x00019] in <52a2eb53628f449d8fde5eb3d5b1035d>:0 
11-15 03:35:58.806 E/mono-rt (12699):   at MonoTorrent.Client.NetworkIO.SendAsync (MonoTorrent.Client.Connections.IConnection2 connection, System.Byte[] buffer, System.Int32 offset, System.Int32 count, MonoTorrent.Client.RateLimiters.IRateLimiter rateLimiter, MonoTorrent.SpeedMonitor peerMonitor, MonoTorrent.SpeedMonitor managerMonitor) [0x002eb] in <12c811a85edc40f4a5c0a38806f10582>:0 
11-15 03:35:58.806 E/mono-rt (12699):   at System.Runtime.CompilerServices.StateMachineCache`1[TStateMachine].OnCompleted () [0x0003a] in <52a2eb53628f449d8fde5eb3d5b1035d>:0 
11-15 03:35:58.806 E/mono-rt (12699):   at System.Runtime.CompilerServices.ResultHolder`1[T].TryInvoke (System.Action callback) [0x0001c] in <52a2eb53628f449d8fde5eb3d5b1035d>:0 
11-15 03:35:58.806 E/mono-rt (12699):   at System.Runtime.CompilerServices.ResultHolder`1[T].TrySetExceptionOrResult (System.Exception exception, T result) [0x00052] in <52a2eb53628f449d8fde5eb3d5b1035d>:0 
11-15 03:35:58.806 E/mono-rt (12699):   at System.Runtime.CompilerServices.ResultHolder`1[T].TrySetResult (T result) [0x00000] in <52a2eb53628f449d8fde5eb3d5b1035d>:0 
11-15 03:35:58.806 E/mono-rt (12699):   at System.Runtime.CompilerServices.ResultHolder`1[T].SetResult (T result) [0x00000] in <52a2eb53628f449d8fde5eb3d5b1035d>:0 

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 51 (51 by maintainers)

Commits related to this issue

Most upvoted comments

@alanmcgovern thanks for taking an interest in finding a fix. Not many maintainers care like this. I’ve really appreciated it.

It hasn’t reproduced yet, but it’ll still running on a pretty small subset of our clients. We should have a better sample size soon

I just checked myself. This error happened on November 30th, the latest version at that time was 1.0.5 So, the error seems to be related to the previous version. Right now I’m using 1.0.6 version. Such error wasn’t discovered after the 2nd of December, the day the latest version of ReusableTasks was released. I will report if this happens again with the latest version.

If the issue hasn’t been resolved please reopen this and i’ll look some more! I clearly need a faster computer to properly test these things 😛