UWP App performance degradation after usage - Windows 10 - c#

I am using MVVM-Caliburn in my UWP application. There is a page where the user can add contacts on a form, and even increase the number of forms by clicking a button (the form is presented in a ListView, with multiple entries as per usage).
I have turned page caching as ENABLED.
this.NavigationCacheMode = Windows.UI.Xaml.Navigation.NavigationCacheMode.Enabled;
The problem is that after a while, this particular page starts to slow down a lot and certain operations (even textbox input!) starts to take a lot of time.
Does this have to do with the fact that something gets cached and after a while, it starts to affect down the application performance?
Any help or direction in this matter will be welcomed.

Related

Limited controls in WPF Form (win32exception conflicts with 10,000 controls per window)

I have a program running fine but when it hit nearly 10,000 images in WPF form thrown exception System.ComponentModel.Win32Exception: The operation completed successfully.
it so weird, sounds poor design, but functioning well as per the requirements. Without splitting process in to multiple, is there any better way that helps in getting rid of this issue and allow users to process over 10,000 images (controls in form).
I have double checked unmanged code disposed properly and used using blocks etc..
Background : Application creates image thumbnails of PDF pages and the images are stored in cache. Application is working well in handling a big load in giga bytes though it takes fair bit of time to create images on screen .(this is an acceptable delay)
It sounds like you have reached the Windows limit of 10,000 user handles.
You might want to try batching up the processing, or maybe using a virtualizing panel like the VirtualizingStackPanel to display the images. This will only create UI controls as they are scrolled into view.

Bing maps control hangs the back navigation

I recently ran into weird bug in Bing map control. In short, if the connection is poor and you press the hardware back button on page with map while the map is still loading some tiles, the navigation process hangs up (some times up to 10 or even more seconds). And in case when the time is more than 3 seconds the app will be "a little" not user-friendly and will not meet the technical certification requirements (5.1.3).
To repeat the bug you can create the app with two pages. First one with button to navigate to the second page. And the second page with just map control with high ZoomLevel (more than 14 for example). After the app launches, you navigate to the second page and move map to some unloaded area and then (without waiting for the download to complete) press the hardware back button. And also you somehow must "create poor" connection (in my case, simply disconnecting the device from the computer is enough).
And does anyone have any idea why this occurs and how to workaround it?
EDIT: The same bug can be observed in the Foursquare application for wp7 - if you go to the page where the place is shown on the map in full screen, then slide the map into an unloaded region and press the hardware button back.
It seems that the problem is in the Bing Map Control.
Hide the Maps control using the Visibility first, before you navigate out of the page. That way the control will become inactive and memory consumption of the page will decrease, thus allowing to switch pages faster.

.Net WebBrowser Control memory leak

My c# application uses .net WebBrowser. I need to close child control everytime and I have noticed WebBrowser is not getting disposed and RAM consumption is increasing heavily with each call (around 10 mb on each new control declaration) and application crashes in sometime with OutOfMemoryException. Searched over forums but couldn't find a clean solution.
Tried SetProcessWorkingSetSize(pHandle, -1, -1); but it doesn't reduce virtual memory though RAM uses will be reduced and its not a clean way of overcoming the issue.
Seems this issues exists since years, for more details look at this thread How to get around the memory leak in the .NET Webbrowser control?
Any suggestions ? Tried almost everything but no success yet.
Thanks,
Abhinav
I don't know whether your situation is similiar to mine but I have wasted three days for that weird problem.
My application was performing a search on a web page and my code was like that;
1.Open web page
for(1000 times)
{
2.Write input and click search button.
3.Check the result.
}
As you see my program opens the web page and makes repeated searches.Here opening the page (navigaiton) occurs only one time. My program's memory consumption was continuously increasing even above 1 GB! Then I tried putting the navigation inside the loop it worked.
for(1000 times)
{
1.Open web page
2.Write input and click seach button.
3.Check the result.
}
I exactly don't know the reason but reusing the same page for a long time was the cause of my problem. I hope it helps.

asp timer and update panel

I have a small web application I am working on that is basically a radio player that plays live radio. On the player we have the schedule and what's playing now etc. I used a asp timer and update panel to update various content on the player mainly the 'what's playing now' bit.
Last time we tried to use the asp timer and update panel on our website it crashed the webserver in minutes because the cpu went to 100% and it could not handle that many postbacks. I am wondering what the best way of optimizing this radio player is so that it does not crash?
I have thought I could load all the content in on page load in hidden fields then use jquery? Sounds a bit messy but open to ideas?
Creating some Javascript that updates the update panel on certain timestamps isn't that much work. Send the expected end-time to the browser and let it update once the song ends.
You can even send a list of queued songs to the browser so it only has to update the data once in a while. (depending on play list style)
Make sure the update panel server side uses as much as possible cached output so it does not have to find the currently playing song. IIRC an update panel has quite some overhead, calling a clean JSON request to only retrieve the currently playing song might be much cleaner.
check view state is not enabled - this will quickly eat up memory.
You could use JQuery to fill in a portion of your page (or several portions) after the initial PageLoad. I have learnt how to do this recently and it feels better than the timer and update panels. See this post for how I achieved it - the answer from jwiscarson has the detail.

Effecient Coding for low end CPU

I have a application built in Silverlight, which will run on a ATOM processor (was told around 1.6GHZ).
So far tested another application with lesser functions on another Mini PC and it can still run smoothly.
This application will be user interactive, and will have 4-5 different pages to be displayed.
So to navigate from page to page, I currently have 2 options, but not sure which is a better way considering the low end CPU. (pages are static, nothing generated on the fly)
1)Load the 4 - 5 pages during the onLoad event, shown the 1st page using Visibility.Visible.
The other pages will be Visibility.Collasped. This way, only need to toggle the Visibility property, pages need not be destroyed and re-created.
2)Initialize all the pages when loaded. Use Container.child to attach the wanted page. Not sure about the capability about this, but for other applications, I usually choose this method.
*P/S: I am okay if it takes a while to load,as the application will be loaded only once per day. As long as during the running period, it does not lag(using touchscreen) I am more than happy.
The main trick is to keep effects to a minimum. Animations etc. - not a problem in a normal application, more in a game or something. For normal LOB style apps, the CPU would not be too busy anyway.

Categories