Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while drawing square #172

Open
austin-owensby opened this issue Jul 22, 2023 · 3 comments
Open

Error while drawing square #172

austin-owensby opened this issue Jul 22, 2023 · 3 comments

Comments

@austin-owensby
Copy link

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 austin-owensby changed the title Error while drawling square Error while drawing square Jul 22, 2023
harrisi added a commit to harrisi/Chess-Challenge that referenced this issue Jul 22, 2023
I'm not sure if this is an actual fix, but it's difficult to recreate.
This allows for multiple writers and readers, so there may be some
instances where the highlighted cells are incorrect, but I'm not sure
how that would happen. This also should only happen when rapidly
visualizing bots, so shouldn't ever be noticeable anyway.
@harrisi
Copy link

harrisi commented Jul 22, 2023

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.

@Earthcomputer
Copy link

Earthcomputer commented Jul 29, 2023

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

@Xenymor
Copy link

Xenymor commented Aug 6, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants