0

I am not sure as to why I am now getting this error. It seemed to have cropped up from no where. Upon the user's request I am creating a cycle tile of in app images, fairly straightforward. The tile is actually created and displayed on the start screen, with the images intact.

ShellTile.Create(new Uri("/Pages/StreamPage.xaml?id=cycle", UriKind.Relative), tileData, true);

I THEN get the error when testing on emulator, release mode, WP8

enter image description here

Matthew
  • 3,976
  • 15
  • 66
  • 130

1 Answers1

0

Make sure that you're creating the tile on the UI thread. Also if it's already created before and then you try to create a new one, you get this error.

Dispatcher.BeginInvoke(()=>{
 ShellTile tile= ShellTile.ActiveTiles.FirstOrDefault(t =>t.NavigationUri.ToString().Contains("cycle"));
 if (tile == null)
 {
   ShellTile.Create(new Uri("/Pages/StreamPage.xaml?id=cycle", UriKind.Relative) , tileData, true);    
 }});
Abdurrahman Alp Köken
  • 1,236
  • 1
  • 13
  • 12
  • It seems the code is running on the `Main Thread`. I have added a new screenshot with more detail. Also, I have code set up to check whether the tile is already pinned or not, and have validated this working so the tile will only be created if it does not already exist on start screen. – Matthew Oct 04 '14 at 16:39
  • The error seems to only occur in Release mode, as I've just ran in Debug mode to check some values and did not run into any issues. – Matthew Oct 04 '14 at 16:50