Azure-Samples / azure-batch-samples

Azure Batch and HPC Code Samples
Other
260 stars 487 forks source link

Cannot add Default Account Manager via Batch Explorer binaries compiled for Release #181

Closed riverar closed 8 years ago

riverar commented 8 years ago
  1. Accounts, Add, Default Account Manager
  2. Fill in fields with a,b,c,d.
  3. Click OK button, note window does not dismiss
  4. Retry steps with Debug binaries, note feature works as designed
itowlson commented 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.

itowlson commented 8 years ago

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.