I have started a new development project in XNA with the explicit purpose of making it primarily available in silverlight. Because of this I have two solutions, the primary solution is my XNA solution that references the XNA Framework. The secondary solution
references the SilverArcade binaries and all of my source files are added "as link".
As I add new features to the XNA solution I open the SilverArcade solution and run it to make sure everything still works.
There is now something that I have changed that works fine in the XNA solution that doesn't work in the SilverArcade solution and it's not readily obvious why although I have a suspicion.
What I have done is implemented a way for a DrawableGameComponent to signal to the Game that the DrawableGameComponent is closing. It does this through an event that the Game subscribes to when it adds the drawable game component to the the Components list.
When the event is triggered, the Game class clears the Component list, then determines which DrawableGameComponent to show next and adds that new component to the Components list. When I do this I get the following error in the SilverArcade solution "Collection
was modified; enumeration operation may not execute.". The error is in the Game class. Here is the code snippet where the error is ocurring. It is occurring on the line "base.Update(gameTime);" and there is no
inner exception. Any help would be much appreciated.
/// Allows the game to run logic such as updating the world,
/// checking for collisions, gathering input, and playing audio.
/// <param name="gameTime">Provides a snapshot of timing values.</param>
protected override void Update(GameTime gameTime)
// Allows the game to exit
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
// TODO: Add your update logic here