canton7 / Stylet

A very lightweight but powerful ViewModel-First MVVM framework for WPF for .NET Framework and .NET Core, inspired by Caliburn.Micro.
MIT License
996 stars 144 forks source link

Dispose get called twice. #28

Closed wakuflair closed 7 years ago

wakuflair commented 7 years ago

Hi, I encoutered another problem with closing.

This also can be reproduced with Stylet.Samples.RedditBrowser sample, but need a bit of change:

  1. Add IDisposable to the SubredditViewModel class.
  2. Implement the Dispose method with any content.
  3. Put a breakpoint inside the Dispose method.
  4. Launch the sample application.
  5. Open a tab, then click the Close button.
  6. The breakpoint will be triggered twice.
canton7 commented 7 years ago

Thanks for spotting this.

Technically this isn't an issue - the Microsoft guidelines are that Dispose methods may be called multiple times, and Dispose implementations should be resilient to this. That said, it's a bit ugly, so I'll try and fix.

canton7 commented 7 years ago

I'll give it another day or two in case you spot something else, then push a new release.