Wulf2k / DaS-PC-MPChan

77 stars 30 forks source link

Crash on Linux/Wine/Mono during updateRecentNodes() #137

Open gammaleak opened 6 years ago

gammaleak commented 6 years ago

DSCM seems to work just fine on Linux using Wine & Mono (an open source .NET reimplementation) until you actually start playing the game with DSCM running.

An exception gets thrown during the call to updateRecentNodes() in the MainWindow.vb file.

I'm not entirely sure about this since I don't have an IDE set up right now to quickly check, but just looking at the exception information below, I suspect the exception gets thrown at line 882:

Dim id As String = recentNodes(i).Cells(1).Value

It's unclear to me what the Mono implementation doesn't like about this. The exception says "No arguments can be provided to Get a field value." My attempts to get DSCM working by installing .NET 4.5 in my Wine environment (aka wineprefix) did not work.

I'll admit that there's a good chance the bug is upstream with Mono, though it's possible that MS .NET internally handles/ignores something wrong about this that isn't technically "to spec."

Nevertheless, if there's something about this that jumps out to you that you might be able to fix, it would make DSCM usable for Linux/Wine users. Dark Souls (and DSFix) are otherwise quite playable via Linux/Wine.

Exception error text below...

Unhandled Exception: System.ArgumentException: No arguments can be provided to Get a field value. Parameter name: bindingFlags at System.RuntimeType.InvokeMember (System.String name, BindingFlags bindingFlags, System.Reflection.Binder binder, System.Object target, System.Object[] providedArgs, System.Reflection.ParameterMod at Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet (System.Object o, System.Type objType, System.String name, System.Object[] args, System.String[] paramnames, System.Boolean[] CopyBack) at Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet (System.Object Instance, System.Type Type, System.String MemberName, System.Object[] Arguments, System.String[] ArgumentNames, System at DSCM.MainWindow.updateRecentNodes () <0xc3d98c0 + 0x0017b> in :0 at DSCM.MainWindow.updateActiveNodes () <0xc3d87d8 + 0x00cf3> in :0 at DSCM.MainWindow._Lambda$__R3-1 (System.Object a0, System.EventArgs a1) <0xc3d8798 + 0x00013> in :0 at System.Windows.Forms.Timer.OnTick (System.EventArgs e) <0xc3ac1f0 + 0x00029> in :0 at System.Windows.Forms.Timer.FireTick () <0xc3ac1d0 + 0x0001a> in :0 at (wrapper remoting-invoke-with-check) System.Windows.Forms.Timer:FireTick () at System.Windows.Forms.XplatUIWin32.GetMessage (System.Windows.Forms.MSG& msg, IntPtr hWnd, Int32 wFilterMin, Int32 wFilterMax, Boolean blocking) <0xb39eca0 + 0x00543> in :0 at System.Windows.Forms.XplatUIWin32.GetMessage (System.Object queue_id, System.Windows.Forms.MSG& msg, IntPtr hWnd, Int32 wFilterMin, Int32 wFilterMax) <0xb39ec58 + 0x00037> in :0 at System.Windows.Forms.XplatUI.GetMessage (System.Object queue_id, System.Windows.Forms.MSG& msg, IntPtr hWnd, Int32 wFilterMin, Int32 wFilterMax) <0xb39ec18 + 0x00039> in :0 at System.Windows.Forms.Application.RunLoop (Boolean Modal, System.Windows.Forms.ApplicationContext context) <0xb2ab6e8 + 0x00b43> in :0 at System.Windows.Forms.Application.Run (System.Windows.Forms.ApplicationContext context) <0xb2ab658 + 0x00043> in :0 at System.Windows.Forms.Application.Run (System.Windows.Forms.Form mainForm) <0xb2ab610 + 0x00033> in :0 at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun () <0x1d593e0 + 0x00057> in :0 at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run (System.String[] commandLine) <0x1d593c8 + 0x00010> in :0 at DSCM.My.MyApplication.Main (System.String[] Args) <0x1d50f58 + 0x0002f> in :0 [ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentException: No arguments can be provided to Get a field value.

Parameter name: bindingFlags

at System.RuntimeType.InvokeMember (System.String name, BindingFlags bindingFlags, System.Reflection.Binder binder, System.Object target, System.Object[] providedArgs, System.Reflection.ParameterMod at Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet (System.Object o, System.Type objType, System.String name, System.Object[] args, System.String[] paramnames, System.Boolean[] CopyBack) at Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet (System.Object Instance, System.Type Type, System.String MemberName, System.Object[] Arguments, System.String[] ArgumentNames, System at DSCM.MainWindow.updateRecentNodes () <0xc3d98c0 + 0x0017b> in :0

at DSCM.MainWindow.updateActiveNodes () <0xc3d87d8 + 0x00cf3> in :0

at DSCM.MainWindow._Lambda$__R3-1 (System.Object a0, System.EventArgs a1) <0xc3d8798 + 0x00013> in :0

at System.Windows.Forms.Timer.OnTick (System.EventArgs e) <0xc3ac1f0 + 0x00029> in :0

at System.Windows.Forms.Timer.FireTick () <0xc3ac1d0 + 0x0001a> in :0

at (wrapper remoting-invoke-with-check) System.Windows.Forms.Timer:FireTick ()

at System.Windows.Forms.XplatUIWin32.GetMessage (System.Windows.Forms.MSG& msg, IntPtr hWnd, Int32 wFilterMin, Int32 wFilterMax, Boolean blocking) <0xb39eca0 + 0x00543> in :0

at System.Windows.Forms.XplatUIWin32.GetMessage (System.Object queue_id, System.Windows.Forms.MSG& msg, IntPtr hWnd, Int32 wFilterMin, Int32 wFilterMax) <0xb39ec58 + 0x00037> in :0 at System.Windows.Forms.XplatUI.GetMessage (System.Object queue_id, System.Windows.Forms.MSG& msg, IntPtr hWnd, Int32 wFilterMin, Int32 wFilterMax) <0xb39ec18 + 0x00039> in :0

at System.Windows.Forms.Application.RunLoop (Boolean Modal, System.Windows.Forms.ApplicationContext context) <0xb2ab6e8 + 0x00b43> in :0

at System.Windows.Forms.Application.Run (System.Windows.Forms.ApplicationContext context) <0xb2ab658 + 0x00043> in :0

at System.Windows.Forms.Application.Run (System.Windows.Forms.Form mainForm) <0xb2ab610 + 0x00033> in :0

at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun () <0x1d593e0 + 0x00057> in :0

at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run (System.String[] commandLine) <0x1d593c8 + 0x00010> in :0

at DSCM.My.MyApplication.Main (System.String[] Args) <0x1d50f58 + 0x0002f> in :0

gammaleak commented 6 years ago

EDIT: A more elegant solution than the one I initially proposed is possible. See below.

Well, I did a dive into the code and I think I figured out a fix. I have to get Dark Souls re-installed in the same wineprefix to be sure, but that should be forthcoming pretty soon.

Anyway, I was wrong in my assumption that the problem was with line 882. The problem is actually with lines 857-859:

For Each row In dgvRecentNodes.Rows
     recentNodeDict.Add(row.Cells("steamId").Value, row)
Next

The issue is that mono doesn't like the type ambiguity in the variable "row" for some reason. So when you try to get a value from row.Cells("columnName") it doesn't let you try to do a get operation on the Cells property with a parameter like that. For whatever reason, mono doesn't automatically translate row from type Object to type DataGridViewRow like (I think) it should.

So the fix is pretty easy:

For Each row As DataGridViewRow In dgvRecentNodes.Rows
     recentNodeDict.Add(row.Cells("steamId").Value, row)
Next

I haven't scoured the code for other places where this might possibly come up.

gammaleak commented 6 years ago

Well, I can confirm this fixes the crash I was having before. There are new crashing problems with Linux/Wine/Mono that have been revealed, now, but this one, at least, has a simple fix.