Hi
In our Application we creting and destroying dynamic views with ViewModels.
1) I have a ListView that ItenSource is binded to a list in the VM => the destructor from the VM will call proper
2) I have also a SfDataGrid on the same view binded to the same VM and Itemsource => destructor is never called.
reproduce:
Download attached example
compile and runn
take a look to the output window:
+++ VM Created +++
GC called
--- VM Destroyed ---
+++ VM Created +++
GC called
--- VM Destroyed ---
+++ VM Created +++
GC called
--- VM Destroyed ---
+++ VM Created +++
GC called
--- VM Destroyed ---
+++ VM Created +++
GC called
--- VM Destroyed ---
+++ VM Created +++
GC called
--- VM Destroyed ---
Stop application
open file View1.xaml
uncommnt line 30 ()
recompile and start application
take look to Output window
+++ VM Created +++
GC called
+++ VM Created +++
GC called
+++ VM Created +++
GC called
+++ VM Created +++
GC called
+++ VM Created +++
GC called
You see the distructer will never be called.
You can see it on Diagnostic tool too after 10 times creating and destroing View1 withot sfDataGrid there are only 1 instance of View1ViewModel in memory using sfDatagris there are 10 !
some more info:
using sfDatagrid and test it with the PerformanceProfiler only one instance of View1ViewModel is in memory ! Compiling to release mode also looks better. It could be that the issu happends only in debug mode. Anyhow we are developing an kiosk app running 7/24 and memory consumption are very important for us
Wolfgang
Double posted, see https://www.syncfusion.com/support/directtrac/incidents/197487
Attachment:
TestSfDataGrid_51197b96.zip