Opened 9 years ago

Closed 9 years ago

#318 closed defect (fixed)

DefaultWarFoundryLoader throws null ref when loading individual files

Reported by: ibboard Owned by: ibboard
Priority: major Milestone: WarFoundry API 0.2
Component: WarFoundry-API Version: Trunk
Keywords: nullref load Cc:
Blocked By: Blocking:

Description

As Tsudico found, the DefaultWarFoundryLoader makes certain assumptions that are valid for mass loading files, but not for individual file loading. This causes null ref exceptions when loading individual files (e.g. in WarFoundry Forge). We need to restructure the file loading to allow for either mechanism.

Change History (9)

comment:1 Changed 9 years ago by ibboard

In [728]:

Re #318: DefaultWarFoundryLoader throws null ref when loading individual files

  • Initial quick fix that should resolve the issues, but isn't ideal in the long run

comment:2 Changed 9 years ago by ibboard

In [729]:

Re #318: DefaultWarFoundryLoader throws null ref when loading individual files

  • Fix quick fix so that it actually works and loads files - but it is still a quick-fix that needs double-checking

comment:3 Changed 9 years ago by Henri

I'm getting an object reference not set to an instance of an object error.

Basically if you you click anywhere in the race-list and do not have a race already selected it crashes. I'll try to avoid doing so for the time being.

comment:4 Changed 9 years ago by ibboard

Do you get a stack trace for that? The one I fixed (which I thought this ticket was about) was a null ref at the point of loading. Clicking around the race list sounds like a post-load null ref, and potentially a different ticket.

comment:5 Changed 9 years ago by Henri

Something like this. Ok, I checked the 0.1 release and it has the same behaviour so this is not something "new" to this, though I happened to notice it in the build after #729 and thought it was because of that.

'WarFoundry.vshost.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_64\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WarFoundry.vshost.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities\9.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WarFoundry.vshost.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WarFoundry.vshost.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WarFoundry.vshost.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WarFoundry.vshost.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities.Sync\9.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.Sync.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WarFoundry.vshost.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.Debugger.Runtime\9.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Debugger.Runtime.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WarFoundry.vshost.exe' (Managed): Loaded 'C:\Users\Henri\Downloads\tortoise\warfoundry\IBBoard.WarFoundry.GUI.WinForms\bin\Debug\WarFoundry.vshost.exe', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WarFoundry.vshost.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_64\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WarFoundry.vshost.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The thread 0x678 has exited with code 0 (0x0).
The thread 0x13f4 has exited with code 0 (0x0).
'WarFoundry.vshost.exe' (Managed): Loaded 'C:\Users\Henri\Downloads\tortoise\warfoundry\IBBoard.WarFoundry.GUI.WinForms\bin\Debug\WarFoundry.exe', Symbols loaded.
'WarFoundry.vshost.exe' (Managed): Loaded 'C:\Users\Henri\Downloads\tortoise\warfoundry\IBBoard.WarFoundry.GUI.WinForms\bin\Debug\log4net.dll'
INFO  [18:12:33]: FrmMain.Main() - Line: 106 - Starting WarFoundry WinForms
'WarFoundry.vshost.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WarFoundry.vshost.exe' (Managed): Loaded 'C:\Users\Henri\Downloads\tortoise\warfoundry\IBBoard.WarFoundry.GUI.WinForms\bin\Debug\IBBoard.dll', Symbols loaded.
'WarFoundry.vshost.exe' (Managed): Loaded 'C:\Users\Henri\Downloads\tortoise\warfoundry\IBBoard.WarFoundry.GUI.WinForms\bin\Debug\IBBoard.WarFoundry.API.dll', Symbols loaded.
'WarFoundry.vshost.exe' (Managed): Loaded 'C:\Users\Henri\Downloads\tortoise\warfoundry\IBBoard.WarFoundry.GUI.WinForms\bin\Debug\IBBoardWF.dll', Symbols loaded.
'WarFoundry.vshost.exe' (Managed): Loaded 'C:\Users\Henri\Downloads\tortoise\warfoundry\IBBoard.WarFoundry.GUI.WinForms\bin\Debug\ICSharpCode.SharpZipLib.dll'
DEBUG [18:12:36]: FrmMain.FrmMain_Load() - Line: 1405 - Attempting to load current game system from properties
A first chance exception of type 'ICSharpCode.SharpZipLib.Zip.ZipException' occurred in ICSharpCode.SharpZipLib.dll
A first chance exception of type 'ICSharpCode.SharpZipLib.Zip.ZipException' occurred in ICSharpCode.SharpZipLib.dll
WARN  [18:12:37]: FrmMain.FileLoadingFinished() - Line: 621 - Failed to load C:\Users\Henri\Downloads\tortoise\warfoundry\IBBoard.WarFoundry.GUI.WinForms\bin\Debug\data\readme.txt: File not handled as a Race or Game System definition: C:\Users\Henri\Downloads\tortoise\warfoundry\IBBoard.WarFoundry.GUI.WinForms\bin\Debug\data\readme.txt
INFO  [18:12:37]: FrmMain.FrmMain_Load() - Line: 1411 - Loaded game system wh from properties
DEBUG [18:12:54]: FrmMain.AddCatToolStripButtons() - Line: 1012 - Toolstrip width: 111
DEBUG [18:12:54]: FrmMain.AddCatToolStripButtons() - Line: 1022 - Button widths: 115
DEBUG [18:12:54]: FrmMain.AddCatToolStripButtons() - Line: 1023 - Toolstrip width: 115
ptsabbrev
A first chance exception of type 'System.NullReferenceException' occurred in WarFoundry.exe
FATAL [18:12:59]: FrmMain.Main() - Line: 108 - System.NullReferenceException: Object reference not set to an instance of an object.
   at IBBoard.WarFoundry.GUI.WinForms.FrmNewArmy.setTxtArmyNameVal() in C:\Users\Henri\Downloads\tortoise\warfoundry\IBBoard.WarFoundry.GUI.WinForms\FrmNewArmy.cs:line 339
   at IBBoard.WarFoundry.GUI.WinForms.FrmNewArmy.lstRaces_SelectedIndexChanged(Object sender, EventArgs e) in C:\Users\Henri\Downloads\tortoise\warfoundry\IBBoard.WarFoundry.GUI.WinForms\FrmNewArmy.cs:line 350
   at System.Windows.Forms.ListBox.OnSelectedIndexChanged(EventArgs e)
   at System.Windows.Forms.ListBox.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.SendMessage(HandleRef hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at System.Windows.Forms.Control.SendMessage(Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.Control.ReflectMessageInternal(IntPtr hWnd, Message& m)
   at System.Windows.Forms.Control.WmCommand(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at System.Windows.Forms.NativeWindow.DefWndProc(Message& m)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ListBox.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
   at IBBoard.WarFoundry.GUI.WinForms.FrmMain.CreateNewArmy() in C:\Users\Henri\Downloads\tortoise\warfoundry\IBBoard.WarFoundry.GUI.WinForms\FrmMain.cs:line 640
   at IBBoard.WarFoundry.GUI.WinForms.FrmMain.miNewArmy_Click(Object sender, EventArgs e) in C:\Users\Henri\Downloads\tortoise\warfoundry\IBBoard.WarFoundry.GUI.WinForms\FrmMain.cs:line 632
   at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
   at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ToolStrip.WndProc(Message& m)
   at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at IBBoard.WarFoundry.GUI.WinForms.FrmMain.Main(String[] args) in C:\Users\Henri\Downloads\tortoise\warfoundry\IBBoard.WarFoundry.GUI.WinForms\FrmMain.cs:line 108
The thread 0x13d4 has exited with code 0 (0x0).
The thread 0x490 has exited with code 0 (0x0).
The program '[3860] WarFoundry.vshost.exe: Managed' has exited with code 0 (0x0).

comment:6 Changed 9 years ago by ibboard

That looks like a different null ref for a different ticket - that one is caused by a coding assumption in the UI, where as this was an issue that Tsudico had with the API.

comment:7 Changed 9 years ago by ibboard

Milestone: WarFoundry 0.2WarFoundry API 0.2

Separate API milestone from UI milestone

comment:8 Changed 9 years ago by ibboard

Status: newaccepted

Accept new tickets en-mass

comment:9 Changed 9 years ago by ibboard

Owner: set to ibboard
Resolution: fixed
Status: acceptedclosed

In [796]:

Fixes #318: DefaultWarFoundryLoader throws null ref when loading individual files

  • Add unit test for loading a single file
Note: See TracTickets for help on using tickets.