Share Contract Closes Immediately RRS feed

  • Question

  • Hi,

    I'm prototyping an application for my company and have hit a snag regarding the Share contract.  If I launch my app then switch over to the Photos app to share a picture to it, my Share contract target page will launch then close nearly immediately.  However, if I close my app then attempt to share a picture from the Photos app, everything seems to be just fine.

    ** I should note that my other contracts behave normally **

    My App.xaml.cs file for OnShareTargetActivated looks like this:

    var shareTargetPage = new ShareTargetPage1();


    In ShareTargetPage1:

    public async void Activate(ShareTargetActivatedEventArgs args)
                this._shareOperation = args.ShareOperation;
                // Communicate metadata about the shared content through the view model
                var shareProperties = this._shareOperation.Data.Properties;
                var thumbnailImage = new BitmapImage();
                this.DefaultViewModel["Title"] = shareProperties.Title;
                this.DefaultViewModel["Description"] = shareProperties.Description;
                this.DefaultViewModel["Image"] = thumbnailImage;
                this.DefaultViewModel["Sharing"] = false;
                this.DefaultViewModel["ShowImage"] = false;
                Window.Current.Content = this;
                // Update the shared content's thumbnail image in the background
                if (shareProperties.Thumbnail != null)
                    var stream = await shareProperties.Thumbnail.OpenReadAsync();
                    this.DefaultViewModel["ShowImage"] = true;

    If I remove

    Window.Current.Content = this;

    It doesn't die immediately, but just hangs on the splash screen.

    I've been unable to find any documentation stating any limits on the target app not allowed to be running for the Share contract to work.

    Is this the expected behavior or is there something that I should be doing different?



    Saturday, March 24, 2012 11:51 PM


  • It seems to be related to having the debugger attached.  If I run normally and back out of my app then launch Photos and share a photo, things seem to just work.

    Robert Mills

    Sunday, March 25, 2012 2:18 PM