Closed riverar closed 8 years ago
Thanks for reporting this. It seems to be related to the 'Optimize code' C# compiler option. When this option is turned on, account messages aren't reaching their MVVM Light registered handlers. Continuing to investigate.
I think the problem is with MVVM Light message handlers implemented as closures. When a message handler lambda closes over a local variable, C# compiles the lambda into a separate (anomymous) class and instantiates that class. But MVVM Light holds only weak references, making the instance eligible for garbage collection. Non-optimised builds hold an artificial reference which keeps the instance alive and allows the message to be delivered; in optimised builds, the instance gets GCed before the message reaches it.