Share Target issues in metro apps

    General discussion

  • While sharing source to target app I was able to share text and get it shown in Target app but when target app tries to call wcf service I got this error 

    Delegate to an instance method cannot have null 'this


    stacktrace says 

     at System.MulticastDelegate.CtorClosed(Object target, IntPtr methodPtr)

       at MyfirstApp.Alert.GetNotification(String wsName) in c:\Anuj\MyfirstApp\MyfirstApp\Alert.xaml.cs:line 50

     public void  ActivateAsync(ShareTargetActivatedEventArgs args)

            {string myWorkspace=string.Empty;

                if (args.Kind == Windows.ApplicationModel.Activation.ActivationKind.ShareTarget)


                   myWorkspace  =  args.ShareOperation.Data.GetText();


                    myAlts.Text = myWorkspace;



     private  void GetNotification(string wsName)




                    if (!string.IsNullOrEmpty(wsName))



                        CoreDispatcher dispatcher = Window.Current.Dispatcher;



                        AllPost.VectorChanged += new VectorChangedEventHandler<object>(VectorChanged);

                        myAlts.Text = wsName;



                catch (Exception ex)




            public async Task GetData()


                ServiceReference1.ReadAndWriteClient client = new ServiceReference1.ReadAndWriteClient();

                ObservableCollection<Notification> notifyList =await client.FetchLatestNotificationsAsync(); // at this line error is thrown



                Window.Current.Content = this;




    • Changed type Anuj Sethi Thursday, December 29, 2011 5:30 AM
    Tuesday, December 27, 2011 2:01 PM

All replies

  • Hi Anuj,

    Is it possible that even though your function looks like it is async it is not?

    What happens if you remove the await modifier?


    Jeff Sanders (MSFT)
    Tuesday, December 27, 2011 2:47 PM
  • It still throws the" Delegate to an instance method cannot have null 'this"  exception when target receives the text and tries to perform WCF call this happens
    Wednesday, December 28, 2011 5:24 AM
  • Did you get this resolved Anuj?  I never saw your reply because you marked my reply as abusive (which it was not).

    Jeff Sanders (MSFT)

    Thursday, February 16, 2012 6:46 PM
  • hi Jeff,

    Your reply was not in right context even I reply whats the issue. Anyways nothing abusive about this I wanted to make it a irrelevant post. As lot of my queries in the forum Some MSFT guy just close it with one liner without any proper solution just for the sake of saying they replied.

    I found lot of your posts very useful you are really helping the community to come on board on Windows 8.Great job :)



    Friday, February 17, 2012 3:41 AM