TorchAPI / Torch

An extensible modding framework and improved client/DS for Space Engineers. Still a work in progress!
Apache License 2.0
146 stars 76 forks source link

Sending text or commands via Torch GUI chat causes application crash. #51

Closed kurazarrh closed 7 years ago

kurazarrh commented 7 years ago

Torch Version: 1.1.207.007 SE Version: 1.182.019

Expected Behavior

The chat text should have been submitted and displayed to players on the server and in the console.

Observed Behavior

Torch crashed with lots of angry red text in the console. (console text pasted in the last section here)

Steps to Reproduce

  1. Run Torch and start a server.
  2. In the "Chat/Players" tab, put the cursor in the text field to the left of the "Send" button.
  3. Type some text or enter a command.
  4. Press the [Enter] key on the keyboard or click the "Send" button.

Other Information

Stacktrace: 20:48:02.3177 [FATAL] Torch: System.InvalidCastException: Unable to cast object of type 'Microsoft.Windows.Themes.ClassicBorderDecorator' to type 'System.Windows.Controls.Border'. at Torch.Server.ChatControl.ChatHistory_CollectionChanged(Object sender, NotifyCollectionChangedEventArgs e) at Torch.ObservableList`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e) at Torch.Managers.MultiplayerManager.SendMessage(String message, String author, Int64 playerId, String font) at Torch.Server.ChatControl.OnMessageEntered() at Torch.Server.ChatControl.Message_OnKeyDown(Object sender, KeyEventArgs e) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args) at System.Windows.Input.InputManager.ProcessStagingArea() at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input) at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport) at System.Windows.Interop.HwndKeyboardInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawKeyboardActions actions, Int32 scanCode, Boolean isExtendedKey, Boolean isSystemKey, Int32 virtualKey) at System.Windows.Interop.HwndKeyboardInputProvider.ProcessKeyAction(MSG& msg, Boolean& handled) at System.Windows.Interop.HwndSource.CriticalTranslateAccelerator(MSG& msg, ModifierKeys modifiers) at System.Windows.Interop.HwndSource.OnPreprocessMessage(Object param) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg) at System.Windows.Interop.HwndSource.OnPreprocessMessageThunk(MSG& msg, Boolean& handled) at System.Windows.Interop.ComponentDispatcherThread.RaiseThreadMessage(MSG& msg) at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at System.Windows.Window.ShowHelper(Object booleanBox) at System.Windows.Window.ShowDialog() at Torch.Server.Program.RunServer(TorchConfig config) at Torch.Server.Program.Main(String[] args)

XeroCreator commented 7 years ago

Did you have essentials on a mod-list? I can't re-pro this.

kurazarrh commented 7 years ago

I just checked the SpaceEngineers-Dedicated.cfg to be sure, but no, the Essentials mod isn't included. I also cleared out my mods folder entirely before migrating from SESE to Torch.

In case it helps, here's my current mod list. Or, I can upload the full log if you need to see it.

``

646796262
<unsignedLong>753102087</unsignedLong>
<unsignedLong>899070352</unsignedLong>
<unsignedLong>473571246</unsignedLong>
<unsignedLong>682707915</unsignedLong>
<unsignedLong>806331071</unsignedLong>
<unsignedLong>678678053</unsignedLong>
<unsignedLong>861361363</unsignedLong>
<unsignedLong>595665128</unsignedLong>
<unsignedLong>570033657</unsignedLong>
<unsignedLong>652337022</unsignedLong>

``

Edit: I'll figure out how to format this eventually...

kurazarrh commented 7 years ago

Just to make sure I wasn't crazy, I fired up a new server, no mods. I create the new server in the vanilla DS application, created a new installation of Torch in another folder, and pointed it at the fresh DS world, and got the same crash. I've finally got attachments working, so I've attached the full log file.

One thing I'm noticing is that it seems to be related to the Windows, er, window manager. Could this bug be caused by running Torch on Windows Server 2008 R2? It doesn't have any of the advanced window styling capabilities that the non-server SKUs have, which would naturally cause any calls or typecasts requiring those methods to fail.

GitHub Torch-2017-07-27.txt

Varaxian commented 7 years ago

I've been having no issues with this. I'd suggest running Windows compatibility tool for access permissions. Fixed me up on a couple of things.

kurazarrh commented 7 years ago

@Varaxian I'm already running the .exe with the "Run as Administrator" box checked (which is what running the compatibility tool for access permissions will turn on), and I've tried running it in compatibility mode for everything available in the list: WinServ2008R2SP1, Vista, VistaSP1, VistaSP2, and Win7.

I've been doing some more digging, and it does appear to be related to making a call to the window manager. The important part of that stacktrace is right at the top:

System.InvalidCastException: Unable to cast object of type 'Microsoft.Windows.Themes.ClassicBorderDecorator' to type 'System.Windows.Controls.Border'.

I'm thinking this was developed on a Win10 machine that supports that typecast action, whereas older OSes may not. Either that, or the issue lies in the Server version of the OS, which has a less-advanced window theme manager.

Varaxian commented 7 years ago

Yup. Doesn't matter. Run the compatibility tool.

On Jul 28, 2017 2:04 PM, "kurazarrh" notifications@github.com wrote:

@Varaxian https://github.com/varaxian I'm already running the .exe with the "Run as Administrator" box checked (which is what running the compatibility tool for access permissions will turn on), and I've tried running it in compatibility mode for everything available in the list: WinServ2008R2SP1, Vista, VistaSP1, VistaSP2, and Win7.

I've been doing some more digging, and it does appear to be related to making a call to the window manager. The important part of that stacktrace is right at the top:

System.InvalidCastException: Unable to cast object of type 'Microsoft.Windows.Themes.ClassicBorderDecorator' to type 'System.Windows.Controls.Border'.

I'm thinking this was developed on a Win10 machine that supports that typecast action, whereas older OSes may not. Either that, or the issue lies in the Server version of the OS, which has a less-advanced window theme manager.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/TorchAPI/Torch/issues/51#issuecomment-318737251, or mute the thread https://github.com/notifications/unsubscribe-auth/AXurF5HpA5GLcXKxnwDPig2kFJaB-ph8ks5sSjC6gaJpZM4Okqph .

kurazarrh commented 7 years ago

@Varaxian Already did. Didn't help.

Jimmacle commented 7 years ago

What version of Windows are you using? This seems like some kind of .NET incompatibility.

kurazarrh commented 7 years ago

I'm running Windows Server 2008 R2. (6.1.7601)

.NET version is 4.7.02053.

Please let me know if there is any other information I can provide to help debug this!

Jimmacle commented 7 years ago

See #68, it appears to be an issue for people using the Windows Classic theme. Working on a fix.