Elmish.WPF icon indicating copy to clipboard operation
Elmish.WPF copied to clipboard

ApplicationAlreadyRunning Exception

Open bainewedlock opened this issue 1 year ago • 2 comments

I tried to make the counter app from the tutorial, but when I start it there is an exception:

System.InvalidOperationException: 'Die Anwendung führt den Verteiler bereits aus.'

I guess this is the untranslated error: ApplicationAlreadyRunning | Application is already running the Dispatcher.

Note: I wasn't able to follow the tutorial exactly, because some functions did not exist with the suggested name.

    let main window =
        Program.mkSimpleWpf init update bindings
        |> Program.runWindow window

bainewedlock avatar Feb 22 '24 08:02 bainewedlock

Can you share a GitHib repo with code that reproduces your problem?

TysonMN avatar Feb 22 '24 13:02 TysonMN

Sure: https://github.com/bainewedlock/elmish-wpf-demo

let me know if you need more details to reproduce the behavior

bainewedlock avatar Feb 22 '24 13:02 bainewedlock

@bainewedlock sorry about the delayed response.

This error happens when you use Program.mkWindow in a context where you already "made" the window with XAML.

Instead use Program.mkSimpleWpf init update bindings |> Program.startElmishLoop ElmConfig.Default window if you are using the Activated event on an already-existing App and Window.

marner2 avatar Apr 03 '24 21:04 marner2

@marner2 great it works, thanks for taking a look at my code!

bainewedlock avatar Apr 06 '24 07:04 bainewedlock