PropertyChangedNotificationInterceptor not working with base Caliburn.Micro.PropertyChangedBase
Closed this issue · 3 comments
You should already be a Patron = TRUE
Describe the issue
All features of Fody/PropertyChanged have worked flawlessly for me within the context of Caliburn.Micro except now that I want to utilize the PropertyChangedNotificationInterceptor. I was looking to implement this feature primarily to ensure that all property changes from async/await thread pool are invoked on the UI thread.
Minimal Repro
Forked PropertyChanged master branch. Adds tests for using Interceptor with Caliburn.Micro's PropertyChangedBase. The new AssemblyWithInterceptorAndCaliburnMicroTests capture the issue with failing tests.
https://github.com/faldeland/PropertyChanged/tree/test/AssemblyWithInterceptorAndCaliburnMicroTests
Make an effort to fix the bug
I dug into it a bit.
ModuleWeaver.FindMethodsForNodes() is never calling AddOnPropertyChangedMethod because the eventInvoker is not null. The RecursiveFindEventInvoker is finding the PropertyChangedBase.OnPropertyChanged method.
I don't fully understand the magic going on behind the scenes with Caliburn.Micro and PropertyChanged, but the two together have helped me tremendously on my current projects.
@faldeland unfortunately the interception feature relies on being able to inject into the OnPropertyChanged method https://github.com/Fody/PropertyChanged/wiki/NotificationInterception#what-gets-compiled
So when using a OnPropertyChanged from a base class (in a diff assembly) then the interception cannot be injectd
@SimonCropp thank you for the clarification. I came to that same conclusion after thinking on it some more. Turns out my desire to use the interceptor for forcing property notifications on the UI thread wasn't needed. A PR question warrented the investigation, and what I'm reading is scalar properties are automatically marshalled to UI thread...which has been our experience. Collections not so much, which I believe is what forces us to invoke those updates on the UI thread. This was a good experience digging into the code.
glad u solved it. happy to close this one?