Chess-Challenge icon indicating copy to clipboard operation
Chess-Challenge copied to clipboard

Error while drawing square

Open austin-owensby opened this issue 2 years ago • 3 comments
trafficstars

Version: 1.11 IDE: Visual Studio 2022 v17.6.5 Platform: Windows 10

I forked the repo on v1.11 and tried to simulate MyBot vs. EvilBot without changing anything just to see what the baseline statistics would come out as, and while running I got this exception in BoardUI.cs's DrawSquare function on line 305:

System.InvalidOperationException
  HResult=0x80131509
  Message=Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
  Source=System.Private.CoreLib
  StackTrace:
   at System.ThrowHelper.ThrowInvalidOperationException_ConcurrentOperationsNotSupported()
   at System.Collections.Generic.Dictionary`2.FindValue(TKey key)
   at System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value)
   at ChessChallenge.Application.BoardUI.DrawSquare(Int32 file, Int32 rank) in C:\Users\aowen\Source\Repos\austin-owensby\Chess-Challenge\Chess-Challenge\src\Framework\Application\UI\BoardUI.cs:line 305
   at ChessChallenge.Application.BoardUI.Draw() in C:\Users\aowen\Source\Repos\austin-owensby\Chess-Challenge\Chess-Challenge\src\Framework\Application\UI\BoardUI.cs:line 203
   at ChessChallenge.Application.ChallengeController.Draw() in C:\Users\aowen\Source\Repos\austin-owensby\Chess-Challenge\Chess-Challenge\src\Framework\Application\Core\ChallengeController.cs:line 380
   at ChessChallenge.Application.Program.Main() in C:\Users\aowen\Source\Repos\austin-owensby\Chess-Challenge\Chess-Challenge\src\Framework\Application\Core\Program.cs:line 41

ChessBug

Trying to include as much debug info as possible since it looks like there may not be a reliable way to reproduce this since from some quick research it may be based on different threads modifying the same collection at once. Locals1 Locals2 Locals3 Locals4

Threads

austin-owensby avatar Jul 22 '23 15:07 austin-owensby

I opened a PR (#175), but I'm not sure if it's the correct way to do it. If you're able to reproduce this, maybe try that patch to see if it works? I can't recreate this locally.

harrisi avatar Jul 22 '23 17:07 harrisi

I just got this error too while running 1000 games of My against EvilBot: image image

Earthcomputer avatar Jul 29 '23 14:07 Earthcomputer

I got it two times. It seems to happen only when starting a new game.

Xenymor avatar Aug 06 '23 21:08 Xenymor