Jump to content
Sign in to follow this  
Guest sky.sanders

item for xxxx was not found in the cache

Recommended Posts

Guest sky.sanders

when developing client applications on the Phone7 platform i occasionally encounter an exception similar to

item for xxxx was not found in the cache

and am having difficulty arriving at a solution..

 

Share this post


Link to post
Guest sky.sanders

If, when developing client applications on the Phone7 platform, you encounter an exception similar to

item for xxxx was not found in the cache

please ensure that you are properly wrapping any interactions with the UI in Dispatcher.BeginInvoke. This exception is lower in the phone7 stack than the CIAPI client library and interferes with proper processing of pending requests resulting in an erroneous exception that masks the actual problem.

The following code throws the exception listed above because of the interactions with buttons that are not withing the invocation.

Dispatcher.BeginInvoke(() => listBox1.Items.Add("rpc client logged in"));

        button1.IsEnabled = true;
        button2.IsEnabled = true;

Again, note that the exception is thrown within CIAPI.Phone7 but the underlying cause is an illegal cross thread access.

The following code executes without issue

Dispatcher.BeginInvoke(() =>
                                   {
                                       listBox1.Items.Add("rpc client logged in");
                                       button1.IsEnabled = true;
                                       button2.IsEnabled = true;
                                   });

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
×