{"action":"created","issue":{"url":"https://api.github.com/repos/FantasticFiasco/mvvm-dialogs/issues/2","labels_url":"https://api.github.com/repos/FantasticFiasco/mvvm-dialogs/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/FantasticFiasco/mvvm-dialogs/issues/2/comments","events_url":"https://api.github.com/repos/FantasticFiasco/mvvm-dialogs/issues/2/events","html_url":"https://github.com/FantasticFiasco/mvvm-dialogs/issues/2","id":118635798,"number":2,"title":"InvalidOperationException(\"View has been garbage collected.\")","user":{"login":"Andy360","id":16001763,"avatar_url":"https://avatars.githubusercontent.com/u/16001763?v=3","gravatar_id":"","url":"https://api.github.com/users/Andy360","html_url":"https://github.com/Andy360","followers_url":"https://api.github.com/users/Andy360/followers","following_url":"https://api.github.com/users/Andy360/following{/other_user}","gists_url":"https://api.github.com/users/Andy360/gists{/gist_id}","starred_url":"https://api.github.com/users/Andy360/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Andy360/subscriptions","organizations_url":"https://api.github.com/users/Andy360/orgs","repos_url":"https://api.github.com/users/Andy360/repos","events_url":"https://api.github.com/users/Andy360/events{/privacy}","received_events_url":"https://api.github.com/users/Andy360/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2015-11-24T15:36:41Z","updated_at":"2015-12-14T11:53:22Z","closed_at":null,"body":"Occasionally, after setting DialogResult = true (or false) in an IModelDialogViewModel using OpenDialog, an exception is thrown from the following location:\r\n\r\n\tpublic FrameworkElement Source\r\n        {          \r\n\t\tget\r\n         \t{\r\n         \t\tif (!this.IsAlive)\r\n         \t\t{\r\n         \t\t\tthrow new InvalidOperationException(\"View has been garbage collected.\");\r\n         \t\t}\r\n         \t\treturn (FrameworkElement) this.viewReference.Target;\r\n         \t}\r\n        }\r\n\r\n...that is, for some reason the simple act of setting DialogResult = true leads to a cascade of calls within the MvvmDialogs code that causes the viewReference to be disposed but still modified.\r\n\r\nTop of the call stack at the point the exception is thrown:\r\n\r\nat MvvmDialogs.Views.ViewWrapper.get_Source()\r\n   at MvvmDialogs.DialogServiceViews+<>c__DisplayClass4.<Unregister>b__2(MvvmDialogs.Views.IView)\r\n   at System.Linq.Enumerable.Any[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]\r\n(System.Collections.Generic.IEnumerable`1<System.__Canon>, System.Func`2<System.__Canon,Boolean>)\r\n   at MvvmDialogs.DialogServiceViews.Unregister(MvvmDialogs.Views.IView)\r\n   at MvvmDialogs.DialogServiceViews.OwnerClosed(System.Object, System.EventArgs)\r\n   at System.EventHandler.Invoke(System.Object, System.EventArgs)\r\n   at System.Windows.Window.OnClosed(System.EventArgs)\r\n   at System.Windows.Window.WmDestroy()\r\n   at System.Windows.Window.WindowFilterMessage(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)\r\n   at System.Windows.Interop.HwndSource.PublicHooksFilterMessage(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)\r\n   at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)\r\n   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)\r\n   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)\r\n   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)\r\n   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)\r\n   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)\r\n   at MS.Win32.UnsafeNativeMethods.CallWindowProc(IntPtr, IntPtr, Int32, IntPtr, IntPtr)\r\n   at MS.Win32.HwndSubclass.DefWndProcWrapper(IntPtr, Int32, IntPtr, IntPtr)\r\n   at MS.Win32.UnsafeNativeMethods.CallWindowProc(IntPtr, IntPtr, Int32, IntPtr, IntPtr)\r\n   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)\r\n   at MS.Win32.UnsafeNativeMethods.UnsafeSendMessage(IntPtr, MS.Internal.Interop.WindowMessage, IntPtr, IntPtr)\r\n   at System.Windows.Window.InternalClose(Boolean, Boolean)\r\n   at System.Windows.Window.Close()\r\n   at System.Windows.Window.set_DialogResult(System.Nullable`1<Boolean>)\r\n   at MvvmDialogs.DialogService+<>c__DisplayClass1.<RegisterDialogResult>b__0(System.Object, System.ComponentModel.PropertyChangedEventArgs)\r\n   at System.ComponentModel.PropertyChangedEventHandler.Invoke(System.Object, System.ComponentModel.PropertyChangedEventArgs)\r\n   at GalaSoft.MvvmLight.ObservableObject.RaisePropertyChanged(System.String)\r\n   at LifecycleCRM.UI.ViewModels.InterestedPartyViewModel.set_DialogResult(System.Nullable`1<Boolean>)\r\n\r\n...which is all happening within the ShowDialog call."},"comment":{"url":"https://api.github.com/repos/FantasticFiasco/mvvm-dialogs/issues/comments/164418658","html_url":"https://github.com/FantasticFiasco/mvvm-dialogs/issues/2#issuecomment-164418658","issue_url":"https://api.github.com/repos/FantasticFiasco/mvvm-dialogs/issues/2","id":164418658,"user":{"login":"FantasticFiasco","id":8513095,"avatar_url":"https://avatars.githubusercontent.com/u/8513095?v=3","gravatar_id":"","url":"https://api.github.com/users/FantasticFiasco","html_url":"https://github.com/FantasticFiasco","followers_url":"https://api.github.com/users/FantasticFiasco/followers","following_url":"https://api.github.com/users/FantasticFiasco/following{/other_user}","gists_url":"https://api.github.com/users/FantasticFiasco/gists{/gist_id}","starred_url":"https://api.github.com/users/FantasticFiasco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FantasticFiasco/subscriptions","organizations_url":"https://api.github.com/users/FantasticFiasco/orgs","repos_url":"https://api.github.com/users/FantasticFiasco/repos","events_url":"https://api.github.com/users/FantasticFiasco/events{/privacy}","received_events_url":"https://api.github.com/users/FantasticFiasco/received_events","type":"User","site_admin":false},"created_at":"2015-12-14T11:53:22Z","updated_at":"2015-12-14T11:53:22Z","body":"I've released v1.2.0. It contains the property `MvvmDialogs.Logging.Logger.Writer` which you can use for exposing logs from MVVM Dialogs.\r\n\r\nPlease let me know if you find something useful."}}