1

I'm trying to create a Tile on the Windows Phone start screen. The following code used to work but now it doesn't. I didn't change anything.

    private async static void CreateTile()
    {
        try
        {
            SecondaryTile tileData = new SecondaryTile()
            {
                TileId = "MyTileID",
                DisplayName = "My App Name",
                TileOptions = TileOptions.ShowNameOnLogo,
            };

            tileData.VisualElements.Square150x150Logo = new Uri("ms-appx:///Resources/Images/Tiles/150150.png", UriKind.Absolute);
            tileData.VisualElements.ShowNameOnSquare150x150Logo = true;

            await tileData.RequestCreateAsync();
        }
        catch (Exception ex)
        {

        }
    }

Now it's failing with the error message:

The parameter is incorrect.

and the following Stack Trace:

at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at My.Namespace.SplashPage.<CreateTile>d__f.MoveNext()

I even get the error when I comment everything out, for example:

SecondaryTile tileData = new SecondaryTile()
{
    //TileId = "MyTileID",
    //DisplayName = "My App Name",
    //TileOptions = TileOptions.ShowNameOnLogo,
};

//tileData.VisualElements.Square150x150Logo = new Uri("ms-appx:///Resources/Images/Tiles/150150.png", UriKind.Absolute);
//tileData.VisualElements.ShowNameOnSquare150x150Logo = true;

await tileData.RequestCreateAsync();

So I don't know what parameter is incorrect. What could be causing this? How can I fix it?

Scott Solmer
  • 3,871
  • 6
  • 44
  • 72
DaveDev
  • 41,155
  • 72
  • 223
  • 385
  • 2
    Try using [this](http://msdn.microsoft.com/en-us/library/windows/apps/dn251589.aspx) constructor or setting all the corresponding properties (Arguments is what I think might be the problem). Also, is this a Silverlight or Xaml/WinPRT app? – yasen Oct 29 '14 at 16:42
  • It's a WinRT app. I'll give your suggestion a try in the morning. Thanks. – DaveDev Oct 29 '14 at 16:51
  • Did it work for you? I might use FlipTileData. – Amar Palsapure Jan 04 '16 at 13:35

1 Answers1

1

Try something like this:

    if (SecondaryTile.Exists(tileID)) await tileData.UpdateAsync();
    else await tileData.RequestCreateAsync();
user2962761
  • 130
  • 2
  • 9