-
-
Notifications
You must be signed in to change notification settings - Fork 71
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
stop subscriptions on window close, which is before dispatcher is disposed #355
Conversation
Is this for merging, or just for confirming that #353 can be avoided in user code? If it's for merging:
|
Wow, there's lots of lessons for me in that code! It's the kind of magic that is beyond me unless the wizards care to share. Thanks a lot. Hasn't occurred to me that some "code behind" can be done on the F# side. It is quite a mouthful for what seems to be such a simple issue, so if "possible to fix this in Elmish.WPF code instead" is potentially a much simpler solution in user code, that's certainly very interesting. edit: I just looked at it briefly, but I'm off to an appointment right now, so can't run it now. |
This is for merging. I would also prefer a fix in Elmish.WPF instead. However, as @BentTranberg pointed out in #353 (comment), a fix in Elmish.WPF for #353 would probably also be a fix for #330, but as I said in #330 (comment), I don't have any more ideas for what a fix in Elmish.WPF could be. |
Indeed. There are a lot of ideas coming together here.
Did I miss anything? Is there any other parts that are unclear? |
I realize now that it was an ambiguous statement - true in any case - and thanks a lot again. My original intention was meant to indicate I wouldn't have come up with that kind of solution, though CancellationToken was on my mind. I would not have thought of async, and I would have messed around in the C# project too. Now that I see it, I understand it, but your explanation is on a higher level - not something I could have expressed. |
Fixes #353
The only changes are in the samples. The new code stops the infinite loops inside the subscriptions that would otherwise dispatch a message to a disposed
Dispatcher
.Issue #353 becomes perfectly repeatable for me (in my experience) after decreasing the sleep time
1000
to10
. Do that as well as comment out the subscription toWindow.OnClosing
to confirm that the issue also becomes perfectly repeatable for you. Then comment that line back in to verify that this fix works.@BentTranberg, I think this fixes #353. Do you agree?