Microsoft.XNA.Frameworld.Audio.SoundEffectInstancePool.Update() crashes with an instance not found exception. This error in Visual Studio tags the Program.Main() Run() command.
Appears to be a list insertion/loop error in C# when multithreading. The gameloop base.update() is calling audio management while threads are allowed to make additions to the play pool with SoundEffectInstance calls. Similar problem may occur due to multiple items being added to the pool simultaneously.
This is a common problem in multithreaded applications which modify a single list from multiple threads. C# has difficulty with supporting list changes as they are being iterated. Normally not an issue, but as games have to utilize threads more...it may be worth correcting the problem.
Workaround solution was to create a globally accessible object variable for use with lock(). Any new sound effect instances/.play() calls are contained in the lock on this variable as well as the gameloop.update(){ base.Update() } call.
Recommend adding an improved exception handling on this, or have a lock() within the framework to prevent list changes while performing the update loop through the list of SFX instances.
Microsoft.XNA.Frameworld.Audio.SoundEffectInstancePool.Update() crashes with an instance not found exception. This error in Visual Studio tags the Program.Main() Run() command.
Appears to be a list insertion/loop error in C# when multithreading. The gameloop base.update() is calling audio management while threads are allowed to make additions to the play pool with SoundEffectInstance calls. Similar problem may occur due to multiple items being added to the pool simultaneously.
This is a common problem in multithreaded applications which modify a single list from multiple threads. C# has difficulty with supporting list changes as they are being iterated. Normally not an issue, but as games have to utilize threads more...it may be worth correcting the problem.
Workaround solution was to create a globally accessible object variable for use with lock(). Any new sound effect instances/.play() calls are contained in the lock on this variable as well as the gameloop.update(){ base.Update() } call.
Recommend adding an improved exception handling on this, or have a lock() within the framework to prevent list changes while performing the update loop through the list of SFX instances.
What version of MonoGame does the bug occur on:
What operating system are you using:
What MonoGame platform are you using: