How to try and troubleshoot UI lockup?

I have an app where, in a given test case, a GridView is being populated with up to 26 groups of up to 12 items in each group. The template used for these items initially displays a static graphic but then kicks off a background activity to see if there
is a photo associated with the item to display instead.
The problem I'm having is that even though I'm using Task.Run to run the background activity, the UI remains unresponsive pretty much until the background activity has finished.
Someone has suggested that Image controls can stall the UI thread. Is that true and, if it is, is there anything I can do to alleviate that problem?
Any other suggestions on what I can do to try to figure out why or where the UI thread is getting stalled?
Thanks.

Hi James
In this particular situation, there isn't actually an image being loaded. What happens is that the GridView gets populated with a number of instances of this:
<DataTemplate x:Key="Group80ItemTemplate">
<Grid Margin="6" Width="240" HorizontalAlignment="Left">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border Background="{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}" Width="60" Height="60" Visibility="{Binding ImageIsAvailable, Converter={StaticResource HideIfTrue}}">
<Grid>
<Button HorizontalAlignment="Left" VerticalAlignment="Top" Margin="5,5,0,0" Style="{StaticResource UnstyledGraphicsButtonStyle}" Width="{Binding ImageWidth50}" Height="{Binding ImageHeight50}" Foreground="white" Padding="0" Background="Transparent" BorderBrush="{x:Null}" IsEnabled="False">
<Button.ContentTemplate>
<DataTemplate>
<Viewbox>
<Path Width="{Binding ImageWidth50}" Height="{Binding ImageHeight50}"
Stretch="Uniform" Fill="white"
Data="{Binding ImageContent}"/>
</Viewbox>
</DataTemplate>
</Button.ContentTemplate>
</Button>
<ProgressBar IsIndeterminate="{Binding FetchingImage}" Height="6" Width="60" VerticalAlignment="Bottom" Visibility="{Binding FetchingImage, Converter={StaticResource DisplayIfTrue}}"/>
</Grid>
</Border>
<Border Background="{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}" Width="60" Height="60" Visibility="{Binding ImageIsAvailable, Converter={StaticResource DisplayIfTrue}}">
<Image DataContext="{Binding ImageObject}" Source="{Binding Image}" Stretch="UniformToFill" HorizontalAlignment="Center" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5">
<Image.RenderTransform>
<CompositeTransform Rotation="{Binding Rotation}"/>
</Image.RenderTransform>
</Image>
</Border>
<StackPanel Grid.Column="1" Margin="10,0,0,0" HorizontalAlignment="Stretch">
<TextBlock Text="{Binding Title}" Style="{StaticResource GroupItemTextStyle}" MaxHeight="40" TextWrapping="WrapWholeWords"/>
<TextBlock Text="{Binding Subtitle}" Style="{StaticResource CaptionTextBlockStyle}" TextWrapping="NoWrap"/>
</StackPanel>
</Grid>
</DataTemplate>
XAML then binds to ImageObject which is null initially if we don't have an image (ImageIsAvailable is false so this section is actually collapsed). The call to the ImageObject getter causes the related object to be added to a queue that is then processed
via a worker task in order to query the database to see if there is an associated image record and, if there is, whether or not we have a file to go with it. IF the various bits and pieces come together so that we do have an image, the various properties change
so that XAML is then triggered into querying ImageIsAvailable, ImageObject and Image all over again in order to then display the image.
However, as I say, in this particular test that I'm running, NONE of the objects have any images so although the initial XAML call to ImageObject will trigger that worker task to process the queue, XAML doesn't update again. My concern is that it would *appear*
that the UI thread stops responding (e.g. to sideways swipes on the screen) until the queue has been completely processed. I've managed to alleviate the problem slightly by gradually adding objects to the GridView (I was initially building the groups in a
single Task and then adding them as the source to the GridView in one go) but I don't seem to be able to completely eliminate the problem.
Someone on StackOverflow suggested that the Image control itself can cause a slight UI lockup but I'm not sure if that is the cause here given that I'm never giving the control anything to display.
What I'm struggling to understand is how the worker task is causing the UI thread to lock up. It doesn't seem to be CPU as analysis shows the app doesn't take 100% CPU. If I had to guess, it would seem that XAML is calling something in my code that simply
isn't returning but I'm not sure what that could be. Part of the challenge I have is that the more debugging statements I add, the slower the code runs (because of all of the Debug.WriteLine statements) so it actually becomes harder to figure out the code
flow.

Similar Messages

  • How the try and catch blocks work?

    For the following section of code from the class QueueInheritanceTest...how the try and catch blocks work?
    The Class...
    public class QueueInheritance extends List {
    public QueueInheritance() { super( "queue" ); }
    public void enqueue( Object o )
    { insertAtBack( o ); }
    public Object dequeue()
    throws EmptyListException { return removeFromFront(); }
    public boolean isEmpty() { return super.isEmpty(); }
    public void print() { super.print(); }
    Testing...
    public class QueueInheritanceTest {
    public static void main( String args[] ){
    QueueInheritance objQueue = new QueueInheritance();
    // Create objects to store in the queue
    Boolean b = Boolean.TRUE;
    Character c = new Character( '$' );
    Integer i = new Integer( 34567 );
    String s = "hello";
    // Use the enqueue method
    objQueue.enqueue( b );
    objQueue.enqueue( c );
    objQueue.enqueue( i );
    objQueue.enqueue( s );
    objQueue.print();
    // Use the dequeue method
    Object removedObj = null;
    try { while ( true ) {
    removedObj = objQueue.dequeue();
    System.out.println(removedObj.toString()+" dequeued" );
    objQueue.print();
    catch ( EmptyListException e ) {
    System.err.println( "\n" + e.toString() );

    If you want a basic introduction to try/catch blocks, read any introductory text or the tutorials on this site.
    Here are some:
    Sun's basic Java tutorial
    Sun's New To Java Center.
    JavaRanch. To quote the tagline on their homepage: "a friendly place for Java greenhorns."
    In terms of this particular case, it looks like the code is using an exception being thrown to get out of a loop. IMHO that's bad design -- exceptions should be used for exceptional circumstances, and if you use it to get out of a loop, then you're certain it's going to happen, and that means that it's not exceptional.
    When you post code, please wrap it in  tags so it's legible.

  • HT1551 how to setup and troubleshoot itunes on apple tv

    How do you setup itunes on apple tv

    In order to use home-sharing you need your computer on and running iTunes, which you access via the computers section.
    Otherwise you access your purchases via the Movies and TV show sections (where you can also rent/purchase new content). If you have iTunes Match you access you use the Music section to access your library from the cloud.

  • How backup User and reinstall osx only

    My MacBook Pro (06 / 2009) running OSX 10.9 Mavericks didnt want to open completly this morning. 6 hrs later i havnt fix it. Reading and trying.
    -- How to make a backup now ?
    I want to save some création of mine. Last backup was 1 Month old on timemachine on external USB drive.
    -- How to reinstall OSX without deleting my User files and maybe my applications Adobe ?
    I have Osx 10.9 Mavericks on machine from free Apple update download. But computer came with 10.5.7 when order from Apple. Also bought 10.6 Snow Léopard  on CD.
    -- What i have done so far
    Reboot. Reset. Pram. Safe mode.
    Single user #reboot
    Single user # /sbin/fsck -FN
    Restart from installation CD to disk utility to verify disk
    Results : nothing
    Disk0s2: i/o error
    Invalid sibling link. The volume needs to ne repaired.

    I suspect it's a bad idea to boot from your Snow Léopard disk (even with the accent) to try to repair Mavericks.
    You could see if your hard drive will mount on another Mac in Target mode: How to use and troubleshoot FireWire target disk mode , then you could backup your créations.
    I would not backup anything more than your essential documents. If you restore system files, you will probably restore the problem.
    If you haven't already: Boot into your recovery partition (restart, hold down ⌘R until you see the Apple logo), and use Disk Utility to repair your hard drive. Repair permissions too while you're there. OS X: About OS X Recovery
    then restart.
    if that doesn't work, you could try the recovery partition again and reinstall Mavericks over your current installation.
    If you can't boot into your recovery partition, then try to boot into internet recovery: Hands on with Mountain Lion's OS X Recovery and Internet Recovery | Macworld , and use Disk Utility to repair your HD.  similarly, if that doesn't work, you could try to erase your HD from internet recovery and reinstall Mavericks.
    if that won't work, you could try TechTool, which can occasionally fix a problem that Disk Utility can't. Techtool Pro 7
    if that doesn't work, then your HD is probably failing and needs to be replaced.

  • HT201250 I just did my first back up with TM and My Passport for Mac, when done adn went into the box ....options...to try and fidn how to delete trash. Then I went back to see if it was erady to do its next scheduled back up and it says there is an error

    I just did my initial back up to hard drive (My Passport for Mac 1TB) with TIme Machine on Snow Leopard. I had wanted to omit trash but couldn't find it. All went great and finished in an hour. Then said would restart at 6pm. I went into options about 20 minutes before (when it was done initially) to try and find how to delete trash from being backed up next time.. THis messed things up and now it doesn't recognize the disk and won't let me manually back up...says error. What do I do?
    JD in AZ

    For all things Time Machine See Pondini's Excellent information here...
    http://pondini.org/OSX/Home.html
    Start Here  >  http://pondini.org/TM/Troubleshooting.html
    Also see the FAQs

  • Trying to import cd, it only shows tracks, not song titles. when i try and get the titles it says im not registered for online use even though im signed in. how can i fix this?

    Im trying to import songs from a cd, but it only shows track numbers, no title of songs.when it try to get the titles it gives error code saying im not registered for online use. i am signed into my account so i dont know how to fix this.

    The "not recognized for on-line use" error is associated with the Gracenote service that iTunes uses to look up and retrieve metadata for CDs.  Some users have reported that this error occurs when trying to import from CD, subsequent to upgrading to version 12.  A number of slightly different solutions have been reported (though all of a similar nature).
    Try walking through the following steps - before starting you may have to enable hidden files and folders to be viewed - in Windows 7 / Windows Explorer select Organize > Folder and search options, then on the View tab make sure that Show hidden files, folders and drives is selected.  Without this you won't see the AppData folder in C:\Users\username\.
    Exit iTunes
    In Windows Explorer, go to the folder C:\Users\username\AppData\Roaming\Apple Computer\iTunes
    Delete the following files:
    CD Info.cidb
    com.apple.iTunes.Gracenote.plist
    Restart iTunes
    Insert a CD and see if details are now correctly retrieved from Gracenote
    If this doesn't work: 
    In iTunes, select Edit > Preferences and make a note (or take a screenshot) of your preferences settings in all relevant tabs
    Exit iTunes
    In Windows Explorer, go to the folder C:\Users\username\AppData\Roaming\Apple Computer\iTunes
    Delete the following file:iTunesPrefs.xml
    Restart iTunes
    Insert a CD and see if details are now correctly retrieved from Gracenote
    If this second procedure does work, you'll need to restore other iTunes preferences settings to those that you noted in step 1.
    If this one didn't work: 
    Exit iTunes
    Check the following folders:
    C:\Users\username\AppData\Local\Apple Computer\iTunes
    C:\Users\username\AppData\LocalLow\Apple Computer\iTunes
    Delete any copies of the following files:
    CD Info.cidb
    com.apple.iTunes.Gracenote.plist
    iTunesPrefs.xml
    Restart iTunes
    Insert a CD and see if details are now correctly retrieved from Gracenote
    Again, if this procedure does work, you'll need to restore other iTunes preferences settings to those that you noted in step 1 of the second procedure. 
    If you're still not able to retrieve CD info: 
    Exit iTunes
    In Windows, select Start > Control Panel > Programs and Features.  Find the entry for iTunes, right-click and select Repair.
    When this process has finished, restart iTunes
    Insert a CD and see if details are now correctly retrieved from Gracenote
    If none of these have worked (and almost everything I've seen suggests you should be OK by this point), you may have an issue with the installation and configuration of iTunes itself.  If you have got this far, see turingtest2's notes on Troubleshooting issues with iTunes for Windows updates for advice on how to remove and replace of all components of iTunes.

  • Every time i try and open safari i get an error message.. how do i reinstall safari so that i can open and use it?

    every time i try and open safari i get an error message.. how do i reinstall safari so that i can open and use it?

    Create a new profile as a test to check if your current profile is causing the problems.
    See "Basic Troubleshooting: Make a new profile":
    *https://support.mozilla.com/kb/Basic+Troubleshooting#w_8-make-a-new-profile
    If that new profile works then you can transfer some files from the old profile to that new profile, but be careful not to copy corrupted files.
    See:
    *http://kb.mozillazine.org/Transferring_data_to_a_new_profile_-_Firefox

  • Had to have my hard drive "cleaned."  Now everything I try and do is a mess.  All my data on my iPhone was deleted.  I'm trying to figure out how to find it.  I can't update my apps.  Always asks for my PW, but tells me it's wrong....HELP!

    I recently had to have my computer hard drive "cleaned."  While this was going on, I broke my SG3, and now own an SG4.
    I also changed servers for the internet.  When I tried to plug in my SG4, after not being on iTunes for some time, all my data was erased.
    No every time I try and do ANYTHING, it asks for my PW.....which is ALWAYS WRONG.....though I've reset it over and over and over.
    I want my data back (contacts, pics, etc.).  But I can't even maneuver around iTunes any more.
    How in the **** do I get someone from iTunes to give me assisstance for the myriad of problems for which I am encountering.  This is a CLUSTERF.....
    HELP!

    There is no such thing as an "SG3" or "SG4".  Did you possibly mean a 3GS and iPhone4?
    It has always been very basic to ensure that a backup exists of your media and other important files.  Computers fail, hard drives crashes... things happen.  Do you not have a backup?  The iPhone, like all iDevices is NOT a backup of your media, but rather a mirror of the content in the iTunes library on your computer.
    If your contacts, pics, etc are not on your computer, no backups of the iPhone exist, and they are not on the phone, they are gone.
    No one can magically make them re-appear.

  • HT201272 If I already downloaded my songs then accidentally deleted them from my computer, how can I redownload them? Itunes store shows them as downloaded and unless I go through and try and repurchase each song individually, it wont let me redownload. h

    How ccan I redownload my music to the same computer. Downloaded, then deleted, now i tunes won't let me redownload, because I already downloaded. If I go through and try and repurchase the songs it will download them for me but I don't want to have to do that 250 times.

    You need to delete the broken entries first, then the tracks will show up with the iCloud download symbols in your purchased histroy and IIRC you can download them all in one go.
    tt2

  • TS3988 When I try and log into the icloud, I get a message that my Apple ID is valid but not an icloud account. How can i make it one?

    Whin I try and long into the icloud, I get a message that my Apple ID is valid, but the it is not an icloud account, how can I make it one?

    To use iCloud on a PC, you must first set it up using a device with iOS5 or a Mac with OS X Lion.

  • I have my itunes account that was created on an old computer i have bought a new one and when i try and sync my phone it says it will update it with the library that is in my new computer which isn't any music. how do i get my music on the new computer?

    I have my iphone that i linked with my old computer. I have since bought a new computer and when i log into my itunes account my music is not there. it is under my phone name but if i try and edit the playlist or create a cd off of my music list nothing happens. How do i get my music list back onto my main itunes page where i can edit it and create cds off of it. i have new songs that i have purchased on my phone that that if i sync my phone it will erase them.  Any information that you provide will be greatly appreciated.
    thanks

    Read this on how to do that https://discussions.apple.com/docs/DOC-3141

  • When I try and print off a list of my contacts, it defaults to an envelope. How do I make a list of just the names?

    When I try and print off a list of my contacts, it defaults to an envelope style, with all the info. I just want a list of names.  How do I do that?

    Thanks so much Martin.  It took me awhile to figure out that in the print mode, there is an arrow that expands the print dialog box.  I've been looking for the print dialog box for awhile, and now that I found it, I could make my list. Thank you SO much!! I can show my computer savvy husband that I learned something new today!!!  I'm SO happy!!!

  • When I try and print an "Approach Plate, or Departure" from ForeFlight to my Epson Stylus NX430 using AirPrint the image is resized. How can I print without it resizing. I want to have the plate print in the original size so I can use it.

    When I try and print an "Approach Plate, or Departure" from ForeFlight to my Epson Stylus NX430 using AirPrint the image is resized. How can I print without it resizing. I want to have the plate print in the original size so I can use it. Is this an Apple, Epson, or Foreflight Issue? I just purchased the printer so I can return it and get a different model or brand. I spoke to Epson and the suggestions given did not resolve the issue. I have cut the paper down to the size of the plate roughly 5.5x8 and it still try's to print at 8.5x11. I have also requested help through ForeFlights Tech help but have yet to receive an answer.
    Please help!

    It varies based on what you ordered and whether it is in stock or has to be assenbled and shipped from China. Your email conformation should give an estimate of when the items are expected to be shipped or available for pick up if you are having it sent to a local Apple Store.

  • I uploaded the giftcard money to my itunes account. and now when i try and buy a song it keeps saying that it has to charge my card. why wont it let me use the giftcard money? how can i fix this?

    i put money to my itunes account. and now when i try and buy a song it keeps saying that it has to charge my card. why wont it let me use the giftcard money? how can i fix this?

    If you still have your old card listed on your account then try selecting the 'none' option and remove it and then try entering the card's details from scratch. If that doesn't work then what is the full error message that you are getting, and the card is registered to the same name and address (including format and spacing) that you have on your iTunes account ?

  • I got a itunes gift card and when i try and buy some thing it asks me for my credit card details how does that work when i have £15 on my fone that i got on a gift card?

    i got a itunes gift card and when i try and buy some thing it asks me for my credit card details how does that work when i have £15 on my fone that i got on a gift card? as i am trying to buy a song and it is starting to really cheese me of now where it keeps asking for credit card details is there a way round it with out having to use a credit card?

    Contact iTunes Customer Service and request assistance
    Use this Link  >  Apple  Support  iTunes Store  Contact

Maybe you are looking for

  • Is it a bug in supporting Characteristic Variable?

    Hi all, I just had a POC on BOE XI 3.1 + SAP Integration Kit 3.1 + SAP BW 7.  We use WebI as the front-end and use OLAP universe to connect to the BEx queries.  I discover that there seems to be an issue with the Characteristic Variable.  If the vari

  • Reuse of Business Packages in WEB DYNPRO FOR ABAP

    Hi folks I have now been working with R3 and CRM for the last 8 years. As ABAP developer. Now we have to find out of if we can use the WEB DYNPRO FOR ABAP in our Portal Soloution. So far so good. Off course we can use the WEB DYNPRO FOR ABAP!! But i

  • Auto thumbnail picture in dream weaver

    How do I have a click and have an image get bigger in my web site using Dream Weaver? Thanks,

  • Graphics Card not detected.

    I bought my laptop two days back. Its the new HP Pavillion dv6 laptop. I have a 2gb AMD Radeon 6770m graphics card installed. But my games do not detect it. Even when i right click on the catalyst center icon on the taskbar i have a tab called Mobile

  • Password creation after installation for root sign in

    When I installed Solaris, I opted out of assigning a password during configuration, and now I cannot login to Solaris Managment Console. How do I creat a post-install password?