locked
Share Target failing for some users RRS feed

  • Question

  • I have an app that is designed to be used primarily as a share target. It works perfectly in all my testing (on different devices, x86, ARM, 8.0, 8.1), but a couple of users are reporting that the app doesn't work when invoked via the Share charm (but works fine when used as a 'normal' app.

    The weird thing is that the app basically does one thing, and it runs the same code whether launched normally or via the share charm (it takes a URL - either from the share contract or typed in/pasted by the user) and sends that via a network request to another device on the user's network.

    I can't reproduce this error *at all*. Sharing just fails with the generic (Windows) error 'Something went wrong and ... can't share'. I have been using the app extensively myself since I made it in late 2012, and have never had any issues (I use it exclusively as a share target).

    Here is the code that runs when invoked via the share charm. The code is basically copied from the sample share target app:

     Me.shareOperation = DirectCast(e.Parameter, ShareOperation)
                Await Task.Factory.StartNew(CType(Async Sub()
                                                      ' Retrieve the data package properties.
                                                      Me.sharedDataTitle = Me.shareOperation.Data.Properties.Title
                                                      Me.sharedDataDescription = Me.shareOperation.Data.Properties.Description
    
                                                      Me.shareQuickLinkId = Me.shareOperation.QuickLinkId
    
                                                      ' Retrieve the data package content.
                                                      If Me.shareOperation.Data.Contains(StandardDataFormats.Uri) Then
                                                          ' The GetUriAsync(), GetTextAsync(), GetStorageItemsAsync(), etc. APIs will throw if there was an error retrieving the data from the source app.
                                                          ' In this sample, we just display the error. It is recommended that a share target app handles these in a way appropriate for that particular app.
                                                          Try
                                                              Me.sharedUri = Await Me.shareOperation.Data.GetUriAsync()
    
                                                          Catch ex As Exception
                                                              NotifyUserBackgroundThread("Failed GetUriAsync - " + ex.Message, NotifyType.ErrorMessage)
                                                          End Try
                                                      End If
    
                                                      Await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, Async Sub()
    
                                                                                                                   If Me.sharedUri IsNot Nothing Then
                                                                                                                       SetupForShareMode(Me.sharedUri.ToString)
                                                                                                                       If UserSettings.Values("autoplay").ToString = "on" Then
                                                                                                                           SendButton.Visibility = Xaml.Visibility.Collapsed
                                                                                                                           UpdateStatus("Finding media...")
                                                                                                                           MediaUrlBox.Visibility = Windows.UI.Xaml.Visibility.Collapsed
                                                                                                                           ProgressIndicator.Visibility = Windows.UI.Xaml.Visibility.Visible
                                                                                                                           If UserSettings.Values("errorlog").ToString = "no xbmc found" Then
                                                                                                                               UpdateStatus("Please run the app and enter your XBMC settings.")
                                                                                                                               Exit Sub
                                                                                                                           End If
    
                                                                                                                           Await ProcessMediaUrl(Me.sharedUri.ToString, False)
    
                                                                                                                           Try
                                                                                                                               Me.shareOperation.ReportCompleted()
                                                                                                                           Catch
                                                                                                                               NotifyUser("Couldn't complete sharing...media may have still sent successfully.", NotifyType.StatusMessage)
                                                                                                                           End Try
    
                                                                                                                       End If
    
    
                                                                                                                   End If
                                                                                                               End Sub)
    
                                                  End Sub, Action))

    The only thing outside of the sample code that the app does is run the method:

    ProcessMediaUrl(Me.sharedUri.ToString, False)
    

    This is exactly the same method run by the app in 'manual'/full screen mode, except that the Uri is obtained from a textbox rather than from the Share charm in that case (the users that report the Share charm method not working say that the fullscreen method always works).

    If anyone is running the home media software XBMC and is willing to test my app, it is called 'XBMC Buddy'. The app is designed to receive a URL to online media (e.g. a Youtube clip) and forward the link to any XBMC device for playback.

    I've been in contact with my users and have gone through all the basic troubleshooting. Either my sharing code is bad (but still works on the majority of setups - including my 4 different Windows devices) or there is a problem in the users' Windows machines (though both users claim to have tested on more than 1 device with the same results).

    Is there anything obvious in my code? FYI the UserSettings that are checked are confirmed/created at app launch time, and thus should always exist (I've updated the app today to check explicitly during sharing, but I doubt this is the problem).


    I'm a self-taught noob amateur. Please take this into account when responding to my posts or when taking advice from me.

    Wednesday, January 8, 2014 12:36 AM

Answers

  • I would love to help you, but it's simply impossible to fix this without better information.  Is there any error/exception information available?  Perhaps you might write some logging functionality to see exactly where the sharing fails.  Of course, it may not be your app at all, but a problem that exists in Windows and/or that particular environment.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Wednesday, January 8, 2014 1:27 PM
    Moderator