Skip to content

Collection was modified; enumeration operation may not execute #3

@valkyrienyanko

Description

@valkyrienyanko

Describe the Issue

Appears when you start / restart server. Seems to be related be a thread synchronization issue with the message list or foreach loop, can't tell for sure.

Unhandled exception. System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
   at System.Collections.Generic.List`1.Enumerator.MoveNext()
   at Terminal.Gui.View.Redraw(Rect region)
   at Terminal.Gui.View.Redraw(Rect region)
   at Terminal.Gui.Toplevel.Redraw(Rect region)
   at Terminal.Gui.Application.Redraw(View view)
   at Terminal.Gui.Application.Begin(Toplevel toplevel)
   at Terminal.Gui.Application.Run(Toplevel view)
   at Terminal.Gui.Application.Run()
   at GameServer.Logging.Logger.Start() in C:\Users\valkyrienyanko\Desktop\game-server\src\GameServer\Logging\Logger.cs:line 55
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

Steps to Reproduce

  1. Run the server with dotnet run
  2. Stop the server with Ctrl + C
  3. Repeat steps 1 through 2 until you see the error

Expected Behavior

None of this should be happening.

Preview

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomershelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions