-
Notifications
You must be signed in to change notification settings - Fork 779
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
Optionally UI Thread property change marshalling #407
Conversation
When combining property change notification with reactive observables there are situations where is desirable that the property change event is leaved as-is, on its original thread. Since WPF already does UI Thread marshaling on bindings, would be useful to be able to turn off this behavior.
Thanks @RafaelSalguero. Hi @nigel-sampson, can you please consider merging? We've discussed this a few months ago, but I'm still having issues, mainly with deadlocking on dispose:
Thank you in advance. |
Sorry this one slipped through my radar, I've no objection to adding this sort of functionality to the framework. One thing though is that I'm not sure adding that static to I would consider adding it to I would then add the same behaviour to |
You simply rock! thanks. |
@RafaelSalguero Can you please revise this PR per @nigel-sampson recommendations? Thanks! |
Hi @nigel-sampson, Can you please verify the issue for the code snippet I posted earlier? Am I missing something? Thanks! |
Which thread is the Dispose being called on? |
Going to close this off with the discussion on #247 on how we'll proceed. |
Hi @nigel-sampson, Dispose is being called on the UI thread (application shutdown), see comments in the code. Thanks! |
Ah, I'd be really hesitant to use locks on the UI thread for fear of holding stuff up. |
Once the application is being terminated, the IoC container is disposing all classes that implement IDisposable automatically... What would you put inside the VM's Dispose in my code example? |
I'm still having difficulties with PropertyChangedBase (and all inheriting classes) marshalling PropertyChanged to the UI thread. For example, the application is being disposed on shutdown, if one of the service classes has a thread Join being called while that thread is changing a VM property, then Join will never complete and the application will never exit. Why not simply add IsPropertyChangedUIMarshallingDisabled (default is false) in IPlatformProvider? isn't this MUCH better than implementing an IPlatformProvider where OnUIThread isn't actually executing something on the UI thread? I wish there'll be a global way to disable this marshalling behaviour, which is completely unnecessary in WPF. |
I'll have another look into this, thanks. |
Hi, did you get a chance to look into this? |
It's on the list for 4.0.0 and will most likely be included, but not sure when I'll do the work. |
That's great news, I'll gladly test the PR. |
Hey @nigel-sampson, I hope it's not too rude, but may I ask whether 4.0.0 (2nd alpha?) is going to be released any time soon? |
Not too rude at all, to be honest it's taking longer than expected mostly because I haven't had a lot of time spare to work on Caliburn.Micro in the last few months beyond triaging issues. I'm not sure when that will change. Hopefully soon but I can't make any promises. |
@nigel-sampson Hey, as far as I understand this can be a simple non-breaking option, how do you see this? can I help with the implementation? Btw, couldn't find it on the 4.0.0 list :) |
I've re-opened this as a reminder. |
Hey @nigel-sampson, any news regarding this? :| How are you planning to implement this? Via IPlatformProvider? I'm eager to test it.. |
This has now been included on master and available through the pre-release feed. |
Hi @nigel-sampson, can you please release a new alpha? |
Will see what I can do, any reason you can't use the MyGet feed? |
I prefer to keep the NuGet chain of reference. Anyway, is there a time table for the next alpha/beta/release? Thanks. |
|
Hi @nigel-sampson, how are you? It seems PropertyChangeNotificationsOnUIThread isn't being checked on ActionMessage's PrepareContext "Guard Names" mechanism. The only workaround I found is
On bootstrapper ctor, but it's a hack in order to disable that feature. |
Thanks, will look into this. |
Can you expand on what problem you're seeing here @superware ? |
ActionMessage is subscribing to PropertyChanged, and the handler is calling Execute.OnUIThread without first checking the platform provider's PropertyChangeNotificationsOnUIThread. If it's false it should update the availability immediately. In my case I'm getting a deadlock, which PropertyChangeNotificationsOnUIThread was designed to prevent on WPF. |
Ok, now I get you, it feels weird to be checking The whole thing smells like a problem with the approach as we shouldn't need to guard every call on However |
@nigel-sampson I am closing this as it seems that the issue it represents have been solved at least partly. If you feel that there is any outstanding work in this PR please let us know. |
When combining property change notification with reactive observables there are situations where is desirable that the property change event is leaved as-is, on its original thread.
Since WPF already does UI Thread marshaling on bindings, would be useful to be able to turn off this behavior.