stride3d / stride3d/stride

Trimmable - Winforms crash on startup

Open
#2,455 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C#
Stars
7.8k
Forks
1.2k
Avg merge
2d 17h
Merged PRs (30d)
49

Description

Release Type: Official Release

Version: 4.2.0.2188

Platform(s): Windows

Describe the bug
Publish Trimmable seems to remove something that Winforms needs to properly function.

To Reproduce
Steps to reproduce the behavior:

  1. use a default project
  2. publish with the trimmable option set to true Publish Trimmable

Expected behavior
Crash bad. No crash good.

Log and callstacks

System.InvalidCastException: Specified cast is not valid.
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode, IntPtr errorInfo)
   at Windows.Win32.Foundation.HRESULT.ThrowOnFailure(IntPtr errorInfo)
   at Windows.Win32.ComHelpers.GetComPointer[T](Object object)
   at Windows.Win32.ComHelpers.GetComScope[T](Object object)
   at System.Windows.Forms.RichTextBox.UpdateOleCallback()
   at System.Windows.Forms.RichTextBox.OnHandleCreated(EventArgs e)
   at System.Windows.Forms.Control.WmCreate(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.TextBoxBase.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(HWND hWnd, MessageId msg, WPARAM wparam, LPARAM lparam)

Additional context
This was found by Discord user DraftedDev and discussed in Discord (https://discord.com/channels/500285081265635328/500292370923913222/1286008639303192628)

Apparently the Trimmable option only affects Winforms as SDL worked.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the crash in a default Windows project using the Publish Trimmable option, then inspect the stack beginning at System.Windows.Forms.RichTextBox.UpdateOleCallback. Compare trimmable and non-trimmable publishes and verify that the published WinForms application starts without the reported InvalidCastException.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.