The following forum(s) are migrating to a new home on Microsoft Q&A (Preview): Developing Universal Windows apps!

Ask new questions on Microsoft Q&A (Preview).
Interact with existing posts until December 13, 2019, after which content will be closed to all new and existing posts.

Learn More

 none
Windows Phone 8.1- "The application identifier provided is invalid" after new app package RRS feed

  • Question

  • I have been working on a new WP 8.1 Store only version of my app, which uses secondary app tiles heavily. However, whenever the app is updated, secondary tiles pinned in previous versions begin to fail to update, giving a "The application identifier provided is invalid" error.

    The following is code used to pin the tile:

     async private void pinLoc_Click(object sender, RoutedEventArgs e)
            {
                //activate background task if it hasn't been turned off
                if (!localStore.Values.ContainsKey(Values.ALLOW_BG_TASK))
                {
                    if (!UpdateTiles.IsTaskRegistered(Values.TASK_NAME))
                    {
                        if (localStore.Values.ContainsKey(Values.UPDATE_FREQ))
                        {
                            UpdateTiles.Register(Values.TASK_NAME, (uint)localStore.Values[Values.UPDATE_FREQ]);
                            return;
                        }
                        UpdateTiles.Register(Values.TASK_NAME, 120);
                    }
                }
                SecondaryTile secondaryTile = new SecondaryTile() { Arguments = currentLocation.LocUrl, TileId = currentLocation.Lat + "_" + currentLocation.Lon, DisplayName = currentLocation.LocName};
                secondaryTile.RoamingEnabled = true; //Reported as doing nothing in WP 8.1
                secondaryTile.TileOptions = TileOptions.CopyOnDeployment; //VS says this is deprecated in 8.1
                secondaryTile.VisualElements.Square71x71Logo = new Uri("ms-appx:///Assets/Square71x71Logo.png");
                secondaryTile.VisualElements.Square150x150Logo = new Uri("ms-appx:///Assets/Logo.png");
                secondaryTile.VisualElements.Square310x310Logo = new Uri("ms-appx:///Assets/SmallLogo.scale-240.png");
                secondaryTile.VisualElements.Wide310x150Logo = new Uri("ms-appx:///Assets/WideLogo.png");
                await secondaryTile.RequestCreateAsync();
            }

    And this is what is used to update the tile:

    try
                {
                    if (tile != null)
                    {
                        TileNotification wideNotif = wideTile.CreateNotification();
                        TileUpdateManager.CreateTileUpdaterForSecondaryTile(tile.TileId).Clear();
                        TileUpdateManager.CreateTileUpdaterForSecondaryTile(tile.TileId).Update(wideNotif);
                    }
                    else
                    {
                        TileNotification wideNotif = wideTile.CreateNotification();
                        TileUpdateManager.CreateTileUpdaterForApplication().Clear();
                        TileUpdateManager.CreateTileUpdaterForApplication().Update(wideNotif);
                    }
                }
                catch (Exception e)
                {
    
                }

    I have seen reports of this happening in the Windows 8.1 simulator, but none of it happening between app updates. However, I have this published as a beta app in the store, and tile updates fail every time, but can be shown by resizing the app tile several times to force a refresh.

    It's possible that this only affects Beta apps in the Windows Phone store, but I would rather not release this app not knowing if it does

    Sunday, July 27, 2014 12:12 AM

All replies

  • Is this an update from WP8.0 to 8.1 app?  (or simple app revision update? i.e. 8.1 to 8.1 )

    What project template was used to create the app project? 

    What is the full OS version on the device you are using to test?


    Eric Fleck, Windows Store and Windows Phone Developer Support. If you would like to provide feedback or suggestions for future improvements to the Windows Phone SDK please go to http://wpdev.uservoice.com/ where you can post your suggestions and/or cast your votes for existing suggestions.

    Monday, July 28, 2014 5:38 PM
  • This was a complete rewrite of a Silverlight 8.0 app to a Windows Store 8.1 app, so almost everything was rewritten for 8.1, with the exception of a few projects that were made to access APIs, which only needed to update how they accessed the internet. The background task especially was from scratch, my old version used the Iconic template, while this renders a bitmapimage and sets the tile to that.

    I believe most of the project was from blank templates under Visual C#>Store Apps>Windows Phone Apps, though I may be using the Hub template and page templates, I don't remember. The app was not retargeted, however; it was completely rewritten.

    Regarding app updates that cause this crash to occur, they are generally small daily modifications to add features and fix bugs to the beta, for which all are 8.1 only; if a live tile is pinned in one version, then the next version will crash on the line

    TileUpdateManager.CreateTileUpdaterForSecondaryTile(tile.TileId).Clear();

    saying that the Application ID provided is invalid. Since posting this, I attempted to publish the app as a hidden app in the store, and then update it to see whether it was a problem with store betas, however, the same crash occurred. The app renders tiles perfectly well, if you resize the tile a few times it seems to force refresh the image, and the updated tile then works. However, because the tiles are not cleared, they no longer seem to be able to update without being resized after the app is updated

    I have been testing on a Lumia Icon running 8.10.12400.899 and a Lumia 620/HTC 8X both running 8.10.12397.895, all on the developer preview. I'm not sure which phones/OS versions that the beta testers are using, but I first published the app as a beta on July 7th, and it had an article written on it on July 9th, so I assume the majority of people are on the developer preview as well.

    Thank you for any assistance you can provide!

    Monday, July 28, 2014 6:08 PM
  • If I understand correctly, the app is using Windows runtime not Silverlight 8.1 runtime ...is that correct?

    Are you calling: CreateTileUpdaterForSecondaryTile from the context of a background task?

    If so, does it make any difference if your main application runs prior to the background task execution? 

    If not, in what context is that code running?  (...what triggers the code to execute?)

    Can you share a simple project which reproduces the error?


    Eric Fleck, Windows Store and Windows Phone Developer Support. If you would like to provide feedback or suggestions for future improvements to the Windows Phone SDK please go to http://wpdev.uservoice.com/ where you can post your suggestions and/or cast your votes for existing suggestions.

    Monday, July 28, 2014 10:26 PM
  • Yes, the app is using Windows runtime. The method containing CreateTileUpdaterForSecondaryTile is called both from a background task and from within the app, and neither running the app (which crashed when it tried to run the method before the try/catch) nor restarting the phone stops this from happening. The full method is as follows:

     public void pushImageToTile(string smallTileLoc, string mediumTileLoc, string wideTileLoc, string compare, string current, string today, string tomorrow, SecondaryTile tile = null)
            {
                //pushes the image to the tiles
                if (tile != null)
                {
                    if (!SecondaryTile.Exists(tile.TileId))
                    {
                        return;
                    }
                }
                ITileSquare71x71IconWithBadge smallTile = TileContentFactory.CreateTileSquare71x71IconWithBadge();
                smallTile.ImageIcon.Src = smallTileLoc;
                smallTile.ImageIcon.Alt = "altSmall";
                smallTile.Branding = TileBranding.Name;
    
    
                ITileSquare150x150PeekImageAndText04 mediumTile = TileContentFactory.CreateTileSquare150x150PeekImageAndText04();
                mediumTile.TextBodyWrap.Text = compare;
                mediumTile.Branding = TileBranding.None;
                mediumTile.Image.Alt = "altMed";
                mediumTile.Image.Src = mediumTileLoc;
                mediumTile.Square71x71Content = smallTile;
    
                ITileWide310x150PeekImageAndText02 wideTile = TileContentFactory.CreateTileWide310x150PeekImageAndText02();
                wideTile.TextBody1.Text = current;
                wideTile.TextBody2.Text = today;
                wideTile.TextBody3.Text = tomorrow;
                wideTile.Branding = TileBranding.None;
                wideTile.Image.Alt = "altWide";
                wideTile.Image.Src = wideTileLoc;
                wideTile.Square150x150Content = mediumTile;
    
                try
                {
                    if (tile != null)
                    {
                        TileNotification wideNotif = wideTile.CreateNotification();
                        TileUpdateManager.CreateTileUpdaterForSecondaryTile(tile.TileId).Clear();
                        TileUpdateManager.CreateTileUpdaterForSecondaryTile(tile.TileId).Update(wideNotif);
                    }
                    else
                    {
                        TileNotification wideNotif = wideTile.CreateNotification();
                        TileUpdateManager.CreateTileUpdaterForApplication().Clear();
                        TileUpdateManager.CreateTileUpdaterForApplication().Update(wideNotif);
                    }
                }
                catch (Exception e)
                {
    
                }
            }

    which, when given a string containing the save location of tiles for the app, and the secondary tile associated (or null if the main tile), which it gets from

    IReadOnlyCollection<SecondaryTile> tiles = await SecondaryTile.FindAllForPackageAsync();

    I can make a simple project by sometime tomorrow, but it only seems to happen between versions where you create an app package, using the Project>Store menu.

    Is there a way you would like me to share the project?

    Monday, July 28, 2014 11:20 PM
  • Ok, this causes the bug with this C# (including NotificationsExtensions for tiles)

    using NotificationsExtensions.TileContent;
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Runtime.InteropServices.WindowsRuntime;
    using System.Threading.Tasks;
    using Windows.Foundation;
    using Windows.Foundation.Collections;
    using Windows.Graphics.Display;
    using Windows.Graphics.Imaging;
    using Windows.Storage;
    using Windows.UI;
    using Windows.UI.Notifications;
    using Windows.UI.StartScreen;
    using Windows.UI.Xaml;
    using Windows.UI.Xaml.Controls;
    using Windows.UI.Xaml.Controls.Primitives;
    using Windows.UI.Xaml.Data;
    using Windows.UI.Xaml.Input;
    using Windows.UI.Xaml.Media;
    using Windows.UI.Xaml.Media.Imaging;
    using Windows.UI.Xaml.Navigation;
    
    // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=391641
    
    namespace SampleBrokenTiles
    {
        /// <summary>
        /// An empty page that can be used on its own or navigated to within a Frame.
        /// </summary>
        public sealed partial class MainPage : Page
        {
            public MainPage()
            {
                this.InitializeComponent();
    
                this.NavigationCacheMode = NavigationCacheMode.Required;
            }
    
            /// <summary>
            /// Invoked when this page is about to be displayed in a Frame.
            /// </summary>
            /// <param name="e">Event data that describes how this page was reached.
            /// This parameter is typically used to configure the page.</param>
            protected override void OnNavigatedTo(NavigationEventArgs e)
            {
                // TODO: Prepare page for display here.
    
                // TODO: If your application contains multiple pages, ensure that you are
                // handling the hardware Back button by registering for the
                // Windows.Phone.UI.Input.HardwareButtons.BackPressed event.
                // If you are using the NavigationHelper provided by some templates,
                // this event is handled for you.
            }
    
            async private void pinButton_Click(object sender, RoutedEventArgs e)
            {
                //pins a tile with arguments, id, and display name from the text box
                txtBox.Text = txtBox.Text.Replace(" ", "");
                SecondaryTile secondaryTile = new SecondaryTile() { Arguments = txtBox.Text, TileId = txtBox.Text, DisplayName = txtBox.Text, RoamingEnabled = true };
                secondaryTile.RoamingEnabled = true; //not implemented for WP
                secondaryTile.TileOptions = TileOptions.CopyOnDeployment; //deprecated in WP 8.1
                secondaryTile.VisualElements.Square71x71Logo = new Uri("ms-appx:///Assets/Square71x71Logo.png");
                secondaryTile.VisualElements.Square150x150Logo = new Uri("ms-appx:///Assets/Logo.png");
                secondaryTile.VisualElements.Square310x310Logo = new Uri("ms-appx:///Assets/SmallLogo.scale-240.png");
                secondaryTile.VisualElements.Wide310x150Logo = new Uri("ms-appx:///Assets/WideLogo.png");
                await secondaryTile.RequestCreateAsync();
            }
    
            async private void refreshTile_Click(object sender, RoutedEventArgs e)
            {
                //refreshes all secondary tiles
                IReadOnlyCollection<SecondaryTile> tiles = await SecondaryTile.FindAllForPackageAsync();
                foreach (SecondaryTile tile in tiles)
                {
                    await updateTile(tile);
                }
            }
            enum TileSize
            {
                small,
                medium,
                wide
            }
            async private Task updateTile(SecondaryTile tile)
            {
             Grid smallImage = createTileImage(TileSize.small);
                Grid medImage = createTileImage(TileSize.medium);
                Grid wideImage =createTileImage(TileSize.wide);
                images.Children.Add(smallImage);
                images.Children.Add(medImage);
                images.Children.Add(wideImage);
                await renderTile(smallImage, tile.TileId + "sm.png");
                await renderTile(medImage, tile.TileId + "me.png");
                await renderTile(wideImage, tile.TileId + "wd.png");
                pushImageToTile("ms-appdata:///local/" + tile.TileId + "sm.png", "ms-appdata:///local/" + tile.TileId + "me.png", "ms-appdata:///local/" + tile.TileId + "wd.png", "a", "b", "c", "d", tile);
            }
    
            private Grid createTileImage(TileSize tileSize)
            {
                Grid g = new Grid() { Background = new SolidColorBrush(Colors.Transparent) };
                if (tileSize == TileSize.small)
                {
                    g.Height = g.Width = 71;
                }
                else if (tileSize == TileSize.medium)
                {
                    g.Width = g.Height = 150;
                }
                else if (tileSize == TileSize.wide)
                {
                    g.Height = 150;
                    g.Width = 310;
                }
                g.Children.Add(createDateTimeText());
                return g;
            }
    
            private TextBlock createDateTimeText()
            {
                return new TextBlock() { Text = DateTime.Now.ToString("HH:mm:ss"), FontSize = 20, Foreground = new SolidColorBrush(Colors.White) };
            }
    
    
            async private Task renderTile(UIElement tile, string tileName)
            {
                RenderTargetBitmap bm = new RenderTargetBitmap();
                await bm.RenderAsync(tile);
                Windows.Storage.Streams.IBuffer pixBuf = await bm.GetPixelsAsync();
                StorageFolder localFolder = ApplicationData.Current.LocalFolder;
                StorageFile tileImageFile = null;
                tileImageFile = await localFolder.CreateFileAsync(tileName, CreationCollisionOption.ReplaceExisting);
                DisplayInformation dispInfo = DisplayInformation.GetForCurrentView();
                if (tileImageFile != null)
                {
                    using (var stream = await tileImageFile.OpenAsync(FileAccessMode.ReadWrite))
                    {
                        var encoder = await BitmapEncoder.CreateAsync(BitmapEncoder.PngEncoderId, stream);
                        encoder.SetPixelData(BitmapPixelFormat.Bgra8, BitmapAlphaMode.Straight, (uint)bm.PixelWidth, (uint)bm.PixelHeight, dispInfo.LogicalDpi, dispInfo.LogicalDpi, pixBuf.ToArray());
                        await encoder.FlushAsync();
                    }
                }
            }
    
            public void pushImageToTile(string smallTileLoc, string mediumTileLoc, string wideTileLoc, string compare, string current, string today, string tomorrow, SecondaryTile tile = null)
            {
                //pushes the image to the tiles
                if (tile != null)
                {
                    if (!SecondaryTile.Exists(tile.TileId))
                    {
                        return;
                    }
                }
                ITileSquare71x71IconWithBadge smallTile = TileContentFactory.CreateTileSquare71x71IconWithBadge();
                smallTile.ImageIcon.Src = smallTileLoc;
                smallTile.ImageIcon.Alt = "altSmall";
                smallTile.Branding = TileBranding.Name;
    
    
                ITileSquare150x150PeekImageAndText04 mediumTile = TileContentFactory.CreateTileSquare150x150PeekImageAndText04();
                mediumTile.TextBodyWrap.Text = compare;
                mediumTile.Branding = TileBranding.None;
                mediumTile.Image.Alt = "altMed";
                mediumTile.Image.Src = mediumTileLoc;
                mediumTile.Square71x71Content = smallTile;
    
                ITileWide310x150PeekImageAndText02 wideTile = TileContentFactory.CreateTileWide310x150PeekImageAndText02();
                wideTile.TextBody1.Text = current;
                wideTile.TextBody2.Text = today;
                wideTile.TextBody3.Text = tomorrow;
                wideTile.Branding = TileBranding.None;
                wideTile.Image.Alt = "altWide";
                wideTile.Image.Src = wideTileLoc;
                wideTile.Square150x150Content = mediumTile;
    
                try
                {
                    if (tile != null)
                    {
                        TileNotification wideNotif = wideTile.CreateNotification();
                        TileUpdateManager.CreateTileUpdaterForSecondaryTile(tile.TileId).Clear();
                        TileUpdateManager.CreateTileUpdaterForSecondaryTile(tile.TileId).Update(wideNotif);
                    }
                    else
                    {
                        TileNotification wideNotif = wideTile.CreateNotification();
                        TileUpdateManager.CreateTileUpdaterForApplication().Clear();
                        TileUpdateManager.CreateTileUpdaterForApplication().Update(wideNotif);
                    }
                }
                catch (Exception e)
                {
    
                }
            }
        }
    }
    

    and this XAML:

    <Page
        x:Class="SampleBrokenTiles.MainPage"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="using:SampleBrokenTiles"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d"
        Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Grid>
            <Grid>
                <TextBox x:Name="txtBox" PlaceholderText="Enter a tile name"/>
    
            </Grid>
            <Grid x:Name="images" Canvas.ZIndex="-1">
                
            </Grid>
        </Grid>
        <Page.BottomAppBar>
            <CommandBar>
                <AppBarButton x:Name="pinButton" Icon="Pin" Click="pinButton_Click"/>
                <AppBarButton x:Name="refreshTile" Icon="Refresh" Click="refreshTile_Click"/>
            </CommandBar>
        </Page.BottomAppBar>
    </Page>
    
    If you go to Project>Store>Create App Package, and create one either for store or not, then continue through, deploy the app, and pin a tile (type a name in the textbox, and click pin), and hit the refresh button, the tile will update. However, if you go through the process of creating an app package again, and attempt to update the tiles, the tiles will not update, aside from the main tile (which I haven't modified here). Instead, the try/catch will catch an Invalid Application Identifier exception

    Tuesday, July 29, 2014 10:09 PM
  • If this helps at all, the app appears to get an error when anyone tries to download it on the most recent WP 8.1 Update 1 (GDR1), error number 80073cf9
    • Edited by CB_27 Monday, August 4, 2014 6:47 PM
    Monday, August 4, 2014 6:46 PM
  • Error value 80073cf9 is just a general "Install failed" error so I can't really say if that has anything to do with the tile update behavior.

    I have not yet had a chance to test the sample code you posted.


    Eric Fleck, Windows Store and Windows Phone Developer Support. If you would like to provide feedback or suggestions for future improvements to the Windows Phone SDK please go to http://wpdev.uservoice.com/ where you can post your suggestions and/or cast your votes for existing suggestions.

    Monday, August 4, 2014 9:04 PM
  • The 80073cf9 seemed to be related to me using either NotificationsExtensions or ToastExtensions, after removing them it works now. The secondary tile update problem still exists though, but this is the code I'm now using:

    public void pushImageToTile(string smallTileLoc, string mediumTileLoc, string wideTileLoc, string compare, string current, string today, string tomorrow, SecondaryTile tile = null)
            {
                //pushes the image to the tiles
                if (tile != null)
                {
                    if (!SecondaryTile.Exists(tile.TileId))
                    {
                        return;
                    }
                }
    
                string tileXml =
                    "<tile>"
                   + "<visual version='3' branding='none'>"
                   + "<binding template='TileSquare71x71Image'>"
                   + "<image id='1' src='" + smallTileLoc + "' alt='altSmall'/>"
                   + "</binding>"
                   + "<binding template='TileSquare150x150PeekImageAndText04' fallback='TileSquarePeekImageAndText04'>"
                   + "<image id='1' src='" + mediumTileLoc + "' alt='altMed'/>"
                   + "<text id='1'>" + compare + "</text>"
                   + "</binding>"
                   + "<binding template='TileWide310x150PeekImageAndText02' fallback='TileWidePeekImageAndText02'>"
                   + "<image id='1' src='" + wideTileLoc + "' alt='altWide'/>"
                   + "<text id='1'>" + current + "</text>"
                   + "<text id='2'>" + today + "</text>"
                   + "<text id='3'>" + tomorrow + "</text>"
                   + "</binding>"
                   + "</visual>"
                   + "</tile>";
    
                XmlDocument tileDom = new XmlDocument();
                tileDom.LoadXml(tileXml);
                try
                {
                    if (tile != null)
                    {
                        TileNotification tileNotif = new TileNotification(tileDom);
                        TileUpdater updater = TileUpdateManager.CreateTileUpdaterForSecondaryTile(tile.TileId);
                        updater.Clear();
                        updater.Update(tileNotif);
                    }
                    else
                    {
                        TileNotification tileNotif = new TileNotification(tileDom);
                        TileUpdateManager.CreateTileUpdaterForApplication().Clear();
                        TileUpdateManager.CreateTileUpdaterForApplication().Update(tileNotif);
                    }
                }
                catch (Exception e)
                {
    
                }
            }

    Thursday, August 7, 2014 12:36 AM
  • Yes, having exact same issues.

    After app is updated, calling CreateTileUpdaterForSecondaryTile() from background task (Windows runtime) starts throwing exception: "The application identifier provided is invalid" if secondary tiles were already pinned. 

    Tuesday, August 19, 2014 9:44 AM
  • Have same issue. On Beta test now, does it reproducing on production?
    Saturday, October 18, 2014 10:52 AM
  • I'm having the same issue. CreateTileUpdaterForSecondaryTile failed after each app upgrade. I'm using Lumia 1520 with WP 8.1 Update 1 (8.10.14219.341) Developer Preview.
    Sunday, January 4, 2015 9:51 PM
  • This issue also happens on the official secondary tiles sample. It could happen on both WP 8.1 and WP 8.1 Update 1.

    https://code.msdn.microsoft.com/windowsapps/secondary-tiles-sample-edf2a178

    Repro steps.

    1. Compile and run the sample.

    2. Select "6".

    3. Choose "Pin to Start".

    4. Change the app version from 1.0.0.0 to 1.0.0.1 in the app manifest file.

    5. Compile and run the sample again.

    6. Select "6".

    7. Choose "Send Tile Notification". And you'll see the exception when calling CreateTileUpdaterForSecondaryTile.

    Sunday, January 4, 2015 10:42 PM
  • Please review the reply from xxxin, the official sample also has same problem.
    Thursday, January 15, 2015 3:01 PM
  • Is there any solution of this problem?
    Tuesday, April 21, 2015 1:56 PM
  • I have the same issue, is there now a fix for this Problem?
    Saturday, May 9, 2015 5:32 AM
  • Seems like this is not fixed yet.

    DYY

    Wednesday, August 12, 2015 5:54 PM
  • Same problem here,...still no solution to this problem? 
    Wednesday, September 2, 2015 8:35 AM
  • Same problem.

    My Application Insights get's full of this exception after an app update.

    Tuesday, October 20, 2015 5:34 PM