Question zu the closed Issue "Delete the ViewModel"

Topics: Issues / bugs, Questions
Jan 21, 2013 at 7:08 AM

Hello

You closed the issue  http://catel.codeplex.com/workitem/7205  on the 12 Jan.

I testet the repro with newest beta from nuget. But it dont works. The application crashes after the second click.

Coordinator
Jan 24, 2013 at 11:27 AM

Re-opened.

Jan 28, 2013 at 7:26 AM
Edited Jan 28, 2013 at 7:27 AM

Hello. Again. You closed again and say it works for you.

What am I doing wrong. Download the example. Installed the newest catel version.

And start:

output:

[DEBUG] [ConfigTestContainer.ViewModels.PageProfileViewModel] Constructor of VM 3

Binding Error (The copy to clipbord function don't works

Click the button first time:

output:

Some BindingExpression Infos

[DEBUG] [ConfigTestContainer.ViewModels.PageProfileViewModel] Constructor of VM 4

[DEBUG] [ConfigTestContainer.ViewModels.PageProfileViewModel] Destructor of VM 3

Click the button second time:

No more response of the application ???

Jan 28, 2013 at 7:40 AM

Ok. When I start the application without Visual Studio it works. But not in Visual Studio. Why?

Jan 28, 2013 at 8:02 AM
Edited Jan 28, 2013 at 8:06 AM

The Problem is the log in the destructor of PageProfileViewModel

Deadlog:

~PageProfileViewModel() {                  Log.Debug("Destructor of VM " + UniqueIdentifier); }

 -->

 ~PageProfileViewModel()
 {
       Task.Factory.StartNew(() => { Thread.Sleep(500);
                                     Log.Debug("Destructor of VM " + UniqueIdentifier);
            });
 }
Jan 28, 2013 at 9:35 AM

In my Application it works not as expectedt. It deletes the old viewmodel not every time I create a new model. But I don't know why.