Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LogWindow something causes crash on Mono #2741

Open
YoshiRulz opened this issue May 15, 2021 · 4 comments
Open

LogWindow something causes crash on Mono #2741

YoshiRulz opened this issue May 15, 2021 · 4 comments
Labels
App: EmuHawk Relating to EmuHawk frontend re: Multiplatform Relating to the Linux and macOS ports (Mono Framework, and eventually .NET Core) Repro: Affects 2.9 dev Repro: Fixed/added in 2.6.2

Comments

@YoshiRulz
Copy link
Member

YoshiRulz commented May 15, 2021

Unhandled Exception:
System.InvalidOperationException: Cannot call Invoke or BeginInvoke on a control until the window handle is created
  at System.Windows.Forms.Control.FindControlToInvokeOn () [0x0001f] in <4b6c441381804088ab0fff508a3fbabf>:0 
  at System.Windows.Forms.Control.BeginInvokeInternal (System.Delegate method, System.Object[] args) [0x00000] in <4b6c441381804088ab0fff508a3fbabf>:0 
  at System.Windows.Forms.Control.BeginInvoke (System.Delegate method) [0x0001d] in <4b6c441381804088ab0fff508a3fbabf>:0 
  at BizHawk.Client.EmuHawk.LogWindow.append (System.String str, System.Boolean invoked) [0x0006d] in <be272c58777343b3aa39f1ac769741f6>:0 
  at BizHawk.Client.EmuHawk.LogWindow.appendInvoked (System.String str) [0x00001] in <be272c58777343b3aa39f1ac769741f6>:0 
  at BizHawk.Client.EmuHawk.LogWindow+LogStream.Write (System.Byte[] buffer, System.Int32 offset, System.Int32 count) [0x0000f] in <be272c58777343b3aa39f1ac769741f6>:0 
  at System.IO.StreamWriter.Flush (System.Boolean flushStream, System.Boolean flushEncoder) [0x00080] in <efe941bb62534dc3a62ceb1a818964a0>:0 
  at System.IO.StreamWriter.WriteSpan (System.ReadOnlySpan`1[T] buffer, System.Boolean appendNewLine) [0x0016b] in <efe941bb62534dc3a62ceb1a818964a0>:0 
  at System.IO.StreamWriter.WriteLine (System.String value) [0x0000d] in <efe941bb62534dc3a62ceb1a818964a0>:0 
  at System.IO.TextWriter+SyncTextWriter.WriteLine (System.String value) [0x00000] in <efe941bb62534dc3a62ceb1a818964a0>:0 
  at (wrapper synchronized) System.IO.TextWriter+SyncTextWriter.WriteLine(string)
  at System.Console.WriteLine (System.String value) [0x00000] in <efe941bb62534dc3a62ceb1a818964a0>:0 
  at BizHawk.Client.EmuHawk.Program.Main (System.String[] args) [0x00012] in <be272c58777343b3aa39f1ac769741f6>:0

Was playing SMW w/ Faust core at 68ba190, went to bind an autofire, and it crashed when I pushed a button. I assume it was the "Bind Event: Press:X0 A" print.

edit: reliable repro:

  1. open The Hawk
  2. Shift+T for Tool Box
  3. Click to focus MainForm and Alt+F4
  4. crash

On closer inspection, the problem is definitely the Tool Box. I must have accidentally opened it while rewinding in SMW.

@YoshiRulz YoshiRulz added App: EmuHawk Relating to EmuHawk frontend Repro: Affects 2.6.2 dev labels May 15, 2021
@zeromus
Copy link
Contributor

zeromus commented May 15, 2021

so call CreateControl on the listview in the logwindow ctor or something like that and comment it as "mysteriously needed for mono only"

@YoshiRulz
Copy link
Member Author

YoshiRulz commented May 15, 2021

The Log Window doesn't need to have been opened for this crash to occur, so I don't see how changing its ctor would help.

edit: Or is the crash caused by never opening the Log Window? I'll look into this more tomorrow.

@zeromus
Copy link
Contributor

zeromus commented May 15, 2021

Lol, if the window hasn't been opened, then what wired it up? Maybe something opened it and then closed it immediately. Anyway, it seems likely the Closing event isn't working and the control is being destroyed before detach() gets called. maybe hunt around for another event to hook into

@YoshiRulz
Copy link
Member Author

YoshiRulz commented Feb 7, 2023

Same stack trace, didn't open the Tool Box this time. (Although I was about to—maybe the Hawk can see the future now.) I simply opened the Log Window from the main menubar. I was on a dev build after 3c3ab65, and my unstaged changes are probably relevant too. Right before this _tools.Add call, I'm reflecting on typeof(LogWindow) and calling Console.WriteLine.

System.InvalidOperationException: Cannot call Invoke or BeginInvoke on a control until the window handle is created
  at System.Windows.Forms.Control.FindControlToInvokeOn () [0x0001f] in <c6f7ca72402d44ffad61bbfb1e840a0f>:0 
  at System.Windows.Forms.Control.BeginInvokeInternal (System.Delegate method, System.Object[] args) [0x00000] in <c6f7ca72402d44ffad61bbfb1e840a0f>:0 
  at System.Windows.Forms.Control.BeginInvoke (System.Delegate method) [0x0001d] in <c6f7ca72402d44ffad61bbfb1e840a0f>:0 
  at BizHawk.Client.EmuHawk.LogWindow.append (System.String str, System.Boolean invoked) [0x0006d] in <b41ce16e05fa4035a39c3a9da1d580ba>:0 
  at BizHawk.Client.EmuHawk.LogWindow.appendInvoked (System.String str) [0x00001] in <b41ce16e05fa4035a39c3a9da1d580ba>:0 
  at BizHawk.Client.EmuHawk.LogWindow+LogStream.Write (System.Byte[] buffer, System.Int32 offset, System.Int32 count) [0x0000f] in <b41ce16e05fa4035a39c3a9da1d580ba>:0 
  at System.IO.StreamWriter.Flush (System.Boolean flushStream, System.Boolean flushEncoder) [0x00080] in <282c4228012f4f3d96bdf0f2b2dea837>:0 
  at System.IO.StreamWriter.WriteSpan (System.ReadOnlySpan`1[T] buffer, System.Boolean appendNewLine) [0x0016b] in <282c4228012f4f3d96bdf0f2b2dea837>:0 
  at System.IO.StreamWriter.WriteLine (System.String value) [0x0000d] in <282c4228012f4f3d96bdf0f2b2dea837>:0 
  at System.IO.TextWriter+SyncTextWriter.WriteLine (System.String value) [0x00000] in <282c4228012f4f3d96bdf0f2b2dea837>:0 
  at (wrapper synchronized) System.IO.TextWriter+SyncTextWriter.WriteLine(string)
  at System.Console.WriteLine (System.String value) [0x00000] in <282c4228012f4f3d96bdf0f2b2dea837>:0 
  at BizHawk.Client.EmuHawk.Program.Main (System.String[] args) [0x00012] in <b41ce16e05fa4035a39c3a9da1d580ba>:0

@YoshiRulz YoshiRulz reopened this Feb 7, 2023
@YoshiRulz YoshiRulz added re: Multiplatform Relating to the Linux and macOS ports (Mono Framework, and eventually .NET Core) Repro: Affects 2.9 dev labels Feb 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
App: EmuHawk Relating to EmuHawk frontend re: Multiplatform Relating to the Linux and macOS ports (Mono Framework, and eventually .NET Core) Repro: Affects 2.9 dev Repro: Fixed/added in 2.6.2
Projects
None yet
Development

No branches or pull requests

2 participants