DieselMeister / Terminal.Gui.Elmish

An elmish wrapper around Miguel de Icaza's 'Gui.cs' https://github.com/migueldeicaza/gui.cs including a fable like view DSL.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Occasionally the window is has random gibberish in it

bretthall opened this issue · comments

Description

Occasionally the window will have random characters show up at random locations.

Repro steps

Please provide the steps required to reproduce the problem

  1. Clone https://github.com/bretthall/workflow-demo
  2. Check out the terminal-elmish-15 branch
  3. Build and run the device project

Expected behavior

You should get a window that looks like this:
Screen Shot 2019-08-25 at 5 17 02 PM

Actual behavior

Sometimes, within 30 seconds of the program starting, the screen will spontaneously change to the following:
Screen Shot 2019-08-25 at 5 23 05 PM

If the issue doesn't happen in the first 30 seconds it doesn't seem to happen at all.

Known workarounds

Use 0.1.13 with work-arounds for issue #8

Related information

  • Operating system: OSX
  • Branch: 0.1.15
  • .NET Runtime, CoreCLR or Mono Version: .net core 2.2
  • Performance information, links to performance testing scripts

You don't need to rush to fix this in time for my Open F# talk, I can make things work with 0.1.13 fine.

@migueldeicaza do you have any idea, what could this be? race condition, when maybe other thread is used?

okay, maybe I try to use a mailbox processor to synchronize the dispatch calls. Maybe this is a thread problem or something.

I see the same. Repro:

  • Clone the repo
  • dotnet run the examples/Elmish.Console.Elements project
  • Go to the TextFields menu item
  • Enter aaaaaaaaaaaaaaaaaaaaaaaaaaaa in the text box, holding down the key, then press backspace - again holding down the key
  • Things break and end up looking like this:

Screenshot 2019-10-05 at 14 39 27

It's worth noting that if I then quit the application, strange characters keep being written to the terminal as below:

Screenshot 2019-10-05 at 14 51 58

These characters are generated when I move the mouse and this stops happening as soon as I disable the "Enable mouse reporting" option in iterm. [EDIT: This is an unrelated issue, upon further investigation I can see that this happens when doing Program.quit regardless of whether subscriptions are in use.]

Initially, I wondered whether something like this would help: https://github.com/elmish/Elmish.WPF/blob/dd631813786db1cf2c473ab51d85e68f0f704d82/src/Elmish.WPF/Program.fs (more discussion here: elmish/Elmish.WPF#40).

I was barking up completely the wrong tree. I tried implementing the mailbox processor and this made no difference. I can see that when disabling subscriptions, the app starts working fine, so I suspect the problem is there...

Huge thanks for sharing the nice wrapper by the way!

Hi. I release a new version (0.1.6). I should fix this issue. A feedback would be nice. Thank you.

Nice! Yes this resolves the issue for me on mac - thanks for the quick fix!

It took me a moment to realise that I needed to remove the spurious Terminal.Gui.Elmish.dll reference, but once I had removed that and done dotnet add package Terminal.Gui.Elmish it all worked perfectly.

Hopefully this resolves your issue too Brett.

edit: I really want to understand this line here! let t = Application.Current.GetType() = typeof<Terminal.Gui.Dialog>

ups forget this. was a debugging test ...

I removed this line from the master.

I close this issue

ups forget this. was a debugging test ...

Ah ok! I thought maybe you had to do a weird hack to force it to evaluate :D