kwsch / NHSE

Animal Crossing: New Horizons save editor
https://berichan.github.io/GetNHSE/
GNU General Public License v3.0
1.03k stars 260 forks source link

Crash when opening Field Item editor while running on Wine #370

Closed wmedlar closed 4 years ago

wmedlar commented 4 years ago

Running build from 9872d82, just wine NHSE.exe.

Dialog box pops up immediately after clicking Edit Field Items ... with the following error:

See the end of this message for details on invoking \njust-in-time (JIT) debugging instead of this dialog box.\n\n************** Exception Text **************\nSystem.IndexOutOfRangeException: Index was outside the bounds of the array.
  at System.Windows.Forms.PropertyGrid.UpdatePropertiesViewTabVisibility () [0x0006e] in <afc71676634a41889c6929c14e8a57bd>:0 
  at System.Windows.Forms.PropertyGrid.ShowEventsButton (System.Boolean value) [0x00061] in <afc71676634a41889c6929c14e8a57bd>:0 
  at System.Windows.Forms.PropertyGrid.set_SelectedObjects (System.Object[] value) [0x004c1] in <afc71676634a41889c6929c14e8a57bd>:0 
  at System.Windows.Forms.PropertyGrid.set_SelectedObject (System.Object value) [0x0001b] in <afc71676634a41889c6929c14e8a57bd>:0 
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.PropertyGrid.set_SelectedObject(object)
  at NHSE.WinForms.FieldItemEditor.LoadEditors () [0x00068] in <a1696c242e54403493f5c028deb5357b>:0 
  at NHSE.WinForms.FieldItemEditor..ctor (NHSE.Core.MainSave sav) [0x00075] in <a1696c242e54403493f5c028deb5357b>:0 
  at (wrapper remoting-invoke-with-check) NHSE.WinForms.FieldItemEditor..ctor(NHSE.Core.MainSave)
  at NHSE.WinForms.Editor.B_EditFieldItems_Click (System.Object sender, System.EventArgs e) [0x00000] in <a1696c242e54403493f5c028deb5357b>:0 
  at System.Windows.Forms.ToolStripItem.RaiseEvent (System.Object key, System.EventArgs e) [0x0001b] in <afc71676634a41889c6929c14e8a57bd>:0 
  at System.Windows.Forms.ToolStripItem.OnClick (System.EventArgs e) [0x00001] in <afc71676634a41889c6929c14e8a57bd>:0 
  at System.Windows.Forms.ToolStripMenuItem.OnClick (System.EventArgs e) [0x0001d] in <afc71676634a41889c6929c14e8a57bd>:0 
  at System.Windows.Forms.ToolStripItem.HandleClick (System.EventArgs e) [0x00051] in <afc71676634a41889c6929c14e8a57bd>:0 
  at System.Windows.Forms.ToolStripItem.HandleMouseUp (System.Windows.Forms.MouseEventArgs e) [0x000fd] in <afc71676634a41889c6929c14e8a57bd>:0 
  at System.Windows.Forms.ToolStripItem.FireEventInteractive (System.EventArgs e, System.Windows.Forms.ToolStripItemEventType met) [0x00053] in <afc71676634a41889c6929c14e8a57bd>:0 
  at System.Windows.Forms.ToolStripItem.FireEvent (System.EventArgs e, System.Windows.Forms.ToolStripItemEventType met) [0x00103] in <afc71676634a41889c6929c14e8a57bd>:0 
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.ToolStripItem.FireEvent(System.EventArgs,System.Windows.Forms.ToolStripItemEventType)
  at System.Windows.Forms.ToolStrip.OnMouseUp (System.Windows.Forms.MouseEventArgs mea) [0x0007d] in <afc71676634a41889c6929c14e8a57bd>:0 
  at System.Windows.Forms.ToolStripDropDown.OnMouseUp (System.Windows.Forms.MouseEventArgs mea) [0x00001] in <afc71676634a41889c6929c14e8a57bd>:0 
  at System.Windows.Forms.Control.WmMouseUp (System.Windows.Forms.Message& m, System.Windows.Forms.MouseButtons button, System.Int32 clicks) [0x001c3] in <afc71676634a41889c6929c14e8a57bd>:0 
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x005a0] in <afc71676634a41889c6929c14e8a57bd>:0 
  at System.Windows.Forms.ScrollableControl.WndProc (System.Windows.Forms.Message& m) [0x00043] in <afc71676634a41889c6929c14e8a57bd>:0 
  at System.Windows.Forms.ToolStrip.WndProc (System.Windows.Forms.Message& m) [0x00128] in <afc71676634a41889c6929c14e8a57bd>:0 
  at System.Windows.Forms.ToolStripDropDown.WndProc (System.Windows.Forms.Message& m) [0x00070] in <afc71676634a41889c6929c14e8a57bd>:0 
  at System.Windows.Forms.Control+ControlNativeWindow.OnMessage (System.Windows.Forms.Message& m) [0x00001] in <afc71676634a41889c6929c14e8a57bd>:0 
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x000b3] in <afc71676634a41889c6929c14e8a57bd>:0 
  at System.Windows.Forms.NativeWindow.Callback (System.IntPtr hWnd, System.Int32 msg, System.IntPtr wparam, System.IntPtr lparam) [0x00030] in <afc71676634a41889c6929c14e8a57bd>:0 

\n************** Loaded Assemblies **************\nmscorlib\n    Assembly Version: 4.0.0.0\n    Win32 Version: 4.6.57.0\n    CodeBase: file:///C:/windows/mono/mono-2.0/lib/mono/4.5/mscorlib.dll\n----------------------------------------\nNHSE\n    Assembly Version: 1.0.0.0\n    Win32 Version: 1.0.0.0\n    CodeBase: file:///Z:/Users/wmedlar/Desktop/newhorizons/NHSE.exe\n----------------------------------------\nSystem.Windows.Forms\n    Assembly Version: 4.0.0.0\n    Win32 Version: 4.6.57.0\n    CodeBase: file:///C:/windows/mono/mono-2.0/lib/mono/gac/System.Windows.Forms/4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll\n----------------------------------------\nSystem\n    Assembly Version: 4.0.0.0\n    Win32 Version: 4.6.57.0\n    CodeBase: file:///C:/windows/mono/mono-2.0/lib/mono/gac/System/4.0.0.0__b77a5c561934e089/System.dll\n----------------------------------------\nSystem.Drawing\n    Assembly Version: 4.0.0.0\n    Win32 Version: 4.6.57.0\n    CodeBase: file:///C:/windows/mono/mono-2.0/lib/mono/gac/System.Drawing/4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll\n----------------------------------------\nAccessibility\n    Assembly Version: 4.0.0.0\n    Win32 Version: \n    CodeBase: file:///C:/windows/mono/mono-2.0/lib/mono/gac/Accessibility/4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll\n----------------------------------------\nSystem.Configuration\n    Assembly Version: 4.0.0.0\n    Win32 Version: 4.6.57.0\n    CodeBase: file:///C:/windows/mono/mono-2.0/lib/mono/gac/System.Configuration/4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll\n----------------------------------------\nNHSE.Core\n    Assembly Version: 1.0.0.0\n    Win32 Version: 1.0.0.0\n    CodeBase: file:///Z:/Users/wmedlar/Desktop/newhorizons/NHSE.Core.dll\n----------------------------------------\nSystem.Core\n    Assembly Version: 4.0.0.0\n    Win32 Version: 4.6.57.0\n    CodeBase: file:///C:/windows/mono/mono-2.0/lib/mono/gac/System.Core/4.0.0.0__b77a5c561934e089/System.Core.dll\n----------------------------------------\nNHSE.Sprites\n    Assembly Version: 1.0.0.0\n    Win32 Version: 1.0.0.0\n    CodeBase: file:///Z:/Users/wmedlar/Desktop/newhorizons/NHSE.Sprites.dll\n----------------------------------------\nMono.Security\n    Assembly Version: 4.0.0.0\n    Win32 Version: 4.0.0.0\n    CodeBase: file:///C:/windows/mono/mono-2.0/lib/mono/gac/Mono.Security/4.0.0.0__0738eb9f132ed756/Mono.Security.dll\n----------------------------------------\nSystem.Xml\n    Assembly Version: 4.0.0.0\n    Win32 Version: 4.6.57.0\n    CodeBase: file:///C:/windows/mono/mono-2.0/lib/mono/gac/System.Xml/4.0.0.0__b77a5c561934e089/System.Xml.dll\n----------------------------------------\n\n************** JIT Debugging **************\n

Console logs for wine show:

Unhandled Exception:
System.InvalidOperationException: Invoke or BeginInvoke cannot be called on a control until the window handle has been created.
  at System.Windows.Forms.Control.MarshaledInvoke (System.Windows.Forms.Control caller, System.Delegate method, System.Object[] args, System.Boolean synchronous) [0x00011] in <afc71676634a41889c6929c14e8a57bd>:0
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control.MarshaledInvoke(System.Windows.Forms.Control,System.Delegate,object[],bool)
  at System.Windows.Forms.Control.BeginInvoke (System.Delegate method, System.Object[] args) [0x0000f] in <afc71676634a41889c6929c14e8a57bd>:0
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control.BeginInvoke(System.Delegate,object[])
  at System.Windows.Forms.WindowsFormsSynchronizationContext.Post (System.Threading.SendOrPostCallback d, System.Object state) [0x0000f] in <afc71676634a41889c6929c14e8a57bd>:0
  at System.__ComObject.Finalize () [0x0001a] in <a1336bab325642fd867e87ca7626bada>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidOperationException: Invoke or BeginInvoke cannot be called on a control until the window handle has been created.
  at System.Windows.Forms.Control.MarshaledInvoke (System.Windows.Forms.Control caller, System.Delegate method, System.Object[] args, System.Boolean synchronous) [0x00011] in <afc71676634a41889c6929c14e8a57bd>:0
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control.MarshaledInvoke(System.Windows.Forms.Control,System.Delegate,object[],bool)
  at System.Windows.Forms.Control.BeginInvoke (System.Delegate method, System.Object[] args) [0x0000f] in <afc71676634a41889c6929c14e8a57bd>:0
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control.BeginInvoke(System.Delegate,object[])
  at System.Windows.Forms.WindowsFormsSynchronizationContext.Post (System.Threading.SendOrPostCallback d, System.Object state) [0x0000f] in <afc71676634a41889c6929c14e8a57bd>:0
  at System.__ComObject.Finalize () [0x0001a] in <a1336bab325642fd867e87ca7626bada>:0

and, not extraordinarily helpful:

Backtrace:
=>0 0x0cc440ba (0x0031d528)
  1 0x6a43eaec call_window_proc+0xbb() in user32 (0x0031d568)
  2 0x6a43eddd WINPROC_call_window+0x26c() in user32 (0x0031d5b8)
  3 0x6a3fef9e call_window_proc+0x8d() in user32 (0x0031d618)
  4 0x6a3f689e send_message+0x11d() in user32 (0x0031d688)
  5 0x6a3f6b8a SendMessageW+0x59() in user32 (0x0031d6e8)
  6 0x6a3d5d70 set_active_window+0x2df() in user32 (0x0031d7b8)
  7 0x6a3d5964 SetActiveWindow+0xf3() in user32 (0x0031d858)
  8 0x6a439bfe WINPOS_ActivateOtherWindow+0x1ad() in user32 (0x0031d888)
  9 0x6a4312ce WIN_SendDestroyMsg+0x5d() in user32 (0x0031d968)
  10 0x6a431078 DestroyWindow+0x4f7() in user32 (0x0031da38)
  11 0x0dfdf02c (0x0031da98)
  12 0x0dfdefa4 (0x0031dab8)
  13 0x0dfdee64 (0x0031db38)
  14 0x1b5187d5 (0x0031dc18)
  15 0x1b51ae02 (0x0031dcc8)
  16 0x1b51aa9c (0x0031dcf8)
  17 0x1b51a3b8 (0x0031ddd8)
  18 0x1b69139c (0x0031de08)
  19 0x11f8a59c (0x0031de38)
  20 0x0dfb551c (0x0031de68)
  21 0x1b691304 (0x0031deb8)
  22 0x1b690ee0 (0x0031def8)
  23 0x1b69079c (0x0031dfd8)
  24 0x0d1654a4 (0x0031f848)
  25 0x0d164b0c (0x0031f878)
  26 0x0d164a80 (0x0031f8a8)
  27 0x0d164780 (0x0031f8d8)
  28 0x03f1195c (0x0031f908)
  29 0x03f119f5 (0x0031f940)
  30 0x00e1c5ee mono_jit_runtime_invoke+0x46d(exc=<is not available>) [Z:\vagrant\mono\mono\mini\mini-runtime.c:3184] in libmono-2.0-x86 (0x00566b68)
  31 0x00000000 (0x00566b68)

and finally system information:

System information:
    Wine build: wine-5.0
    Platform: i386 (WOW64)
    Version: Windows 7
    Host system: Darwin
    Host version: 18.7.0
kwsch commented 4 years ago
        private void LoadEditors()
        {
            var data = GameInfo.Strings.ItemDataSource.ToList();
            var field = FieldItemList.Items.Select(z => z.Value).ToList();
            data.Add(field, GameInfo.Strings.InternalNameTranslation);
            ItemEdit.Initialize(data, true);
            PG_TerrainTile.SelectedObject = new TerrainTile();
        }

Since the stacktrace is at LoadEditors and deals with a set_SelectedObject, I'd think it's implying the last line is what it's having trouble with.

Do other editor windows have issue with the PropertyGrid control? The only thing 'custom' is that the PropertySort property is Categorized. The Turnip prices editor should be a simple PropertyGrid with Categorized as well. Does that editor work fine?

wmedlar commented 4 years ago

Afraid I didn't get a chance to test, I was able to resolve the issue by installing dotnet4 with winetricks.

$ brew install wine-stable winetricks
[...]
$ winetricks dotnet48
<two installation window popups and about 30 minutes of the following error logs ... >
Error: Unknown compression scheme encountered for file '/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/Exceptions.plist'
[...]

Despite the error logs winetricks was successful. So far everything is working in NHSE. I chose dotnet48 simply because it's the most recent version.

note: if winetricks fails with the following error

$ winetricks dotnet48
[...]
dyld: Library not loaded:  [...]
  Reason: image not found
Trace/BPT trap:5

try simply upgrading your brew packages

$ brew update && brew upgrade

This worked for me. I believe the deeper issue was around setting the right path to a shared openssl lib for dyld, but if the easy thing does the trick there's no point in investigating the hard thing!

wmedlar commented 4 years ago

I'll give it a try with a fresh wine install on a new mac — whenever I get one — and report back!

kwsch commented 4 years ago

Glad to hear you were able to resolve the issue :)