Author Topic: [Solved] System.Collections.Generic.KeyNotFoundException  (Read 10668 times)

Offline Oewyn

  • Sr. Member
  • ****
  • Posts: 330
[Solved] System.Collections.Generic.KeyNotFoundException
« on: September 16, 2009, 11:34:21 pm »
Ran into an exception being thrown in the included save game.  It doesn't seem exactly reproducable, but appears to happen when units are firing... related to the new sound modifications you made???



-----------------------------------Application_ThreadException-----------------------------------System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
   at System.ThrowHelper.ThrowKeyNotFoundException()
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at AIWar.GameForm.PlaySound(String Filename, SoundType Type) in C:\vcprojs\AIWar\GameFormParts\Startup.cs:line 2043
   at AIWar.ForegroundObject.FireAtObject(ForegroundObject ObjectToFireAt, Int32 OffsetAmount, FInt OffsetAngle) in C:\vcprojs\AIWar\Framework\ForegroundObject.cs:line 7380
   at AIWar.ForegroundObject.TryAttack(Boolean CanSearchForNewTargets) in C:\vcprojs\AIWar\Framework\ForegroundObject.cs:line 6658
   at AIWar.GameForm.RunNextCycle(Boolean DoRendering, Boolean DoScrollingAndInput) in C:\vcprojs\AIWar\GameFormParts\GameLoop.cs:line 1051
   at AIWar.GameForm.gameLoop() in C:\vcprojs\AIWar\GameFormParts\GameLoop.cs:line 220
   at AIWar.GameForm.GameForm_Load(Object sender, EventArgs e) in C:\vcprojs\AIWar\GameFormParts\Startup.cs:line 252
   at System.Windows.Forms.Form.OnLoad(EventArgs e)
   at System.Windows.Forms.Form.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

9/16/2009 6:36:09 PM (1.202Q)
-----------------------------------Application_ThreadException-----------------------------------System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
   at System.ThrowHelper.ThrowKeyNotFoundException()
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at AIWar.GameForm.PlaySound(String Filename, SoundType Type) in C:\vcprojs\AIWar\GameFormParts\Startup.cs:line 2043
   at AIWar.ForegroundObject.FireAtObject(ForegroundObject ObjectToFireAt, Int32 OffsetAmount, FInt OffsetAngle) in C:\vcprojs\AIWar\Framework\ForegroundObject.cs:line 7380
   at AIWar.ForegroundObject.TryAttack(Boolean CanSearchForNewTargets) in C:\vcprojs\AIWar\Framework\ForegroundObject.cs:line 6658
   at AIWar.GameForm.RunNextCycle(Boolean DoRendering, Boolean DoScrollingAndInput) in C:\vcprojs\AIWar\GameFormParts\GameLoop.cs:line 1051
   at AIWar.GameForm.gameLoop() in C:\vcprojs\AIWar\GameFormParts\GameLoop.cs:line 220
   at AIWar.GameForm.GameForm_Load(Object sender, EventArgs e) in C:\vcprojs\AIWar\GameFormParts\Startup.cs:line 252
   at System.Windows.Forms.Form.OnLoad(EventArgs e)
   at System.Windows.Forms.Form.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
« Last Edit: September 25, 2009, 09:16:48 am by Fiskbit »

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: System.Collections.Generic.KeyNotFoundException
« Reply #1 on: September 17, 2009, 12:07:21 am »
Can you check and make sure that you have ShotSniperLazer.ogg and ShotSniperLazerEnemy.ogg are in your Sounds folder?  It looks like maybe the Q update was not applied completely successfully, but it's hard to be sure.  In the R update, it will give me better debugging info for missing sound effects, in case it still happens for you then...
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline Oewyn

  • Sr. Member
  • ****
  • Posts: 330
Re: System.Collections.Generic.KeyNotFoundException
« Reply #2 on: September 17, 2009, 08:15:20 pm »
Strange, the files weren't there, and after checking the Q patch again, it looks they are contained within the zip file.

I'll let you know if it happens again.

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: System.Collections.Generic.KeyNotFoundException
« Reply #3 on: September 17, 2009, 08:18:01 pm »
Gotcha, that's something of a relief.  I guess maybe the extraction process did not complete originally, or something.
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!