Hello,
=============Update==============
Did you enable the XAML hot reload in your VS?
If so, XAML Hot reload types are present in the managed heap. This may cause objected to be retained that would be otherwise garbage collected
Please disable the XAML hot reload(Tools->Options->debugging->XAML Hot reload-> unselect Enable XAML Hot reload), then debug it.
I update to the Microsoft Visual Studio Community 2022 Version 17.9.2 and test navigation. After several times navigation. The memory will not keep increasing and will maintain a stable value.
1.Is it ok to change different View over time with paramerter(first cto'r )and without the second cto'r?
Firstly, two construction methods, only one of them will be executed every time the page is loaded. If you have two ways to open the MainPage(One is needing attribute, another is not containing attribute, you can keep both of them.
.What about the timer in this case:
doe loaded and unloaded are correct events ?
Do you want to load the data or start/stop timer when page appearing/disappearing? I think OnAppearing method and OnDisappearing method is better,
does the implemntation of timer is correct?
Yes
the handler of the timer -SetIndicatorStatus method should use invoke ? if yes how ?
What does the SetIndicatorStatus method do? I cannot get the detailed code. If you want to change the UI, you need to use MainThread to wrap the change the UI code.
MainThread.BeginInvokeOnMainThread(() => { // hange the UI code. });
do i need to in unloaded event to close the timer it happened when navigating.
Yes
Best Regards,
Leon Lu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.