locked
Recipe4share.App.OnActivated(Windows.ApplicationModel.Activation.ProtocolActivatedEventArgs)': no suitable method found to override

    Question

  • I'm converting my app from VB to C# and almost everything goes well except one thing:

    namespace Recipe4share
    {
    	public sealed partial class App : Application
    	{
    		protected override void OnActivated(ProtocolActivatedEventArgs args)
    		{
    		...
    		}
    
    		protected override void OnLaunched(Windows.ApplicationModel.Activation.LaunchActivatedEventArgs args)
    		{
    		...
    		}
    		...
    	}
    }

    I get the error as stated in the title of this thread. I can't find out what went wrong, especially with OnLaunched not causing the same error.

    I compared I think almost everything with a C# app which works fine, and copy-pasted the OnActivated method in that app's app.xaml.cs and there was no error.

    Friday, May 16, 2014 11:01 AM

Answers

  • You really need to use the correct signature for OnActivated, or the override is not recognized. Please check the source code to cast IActivatedEventArgs to ProtocolActivatedEventArgs right here.
    Friday, May 16, 2014 12:12 PM

All replies

  • Did you try this signature (new EventArgs type):

    protected override void OnActivated(IActivatedEventArgs args)
    {
        // ...
    }

    Friday, May 16, 2014 11:20 AM
  • Did you try this signature (new EventArgs type):

    protected override void OnActivated(IActivatedEventArgs args)
    {
        // ...
    }


    That gave the same error and I need to use ProtocolActivatedEventArgs. If I just copy the method to another C# app, there is no error. There is something else wrong in the solution, I think related with the conversion from VB to C#.
    Friday, May 16, 2014 11:57 AM
  • You really need to use the correct signature for OnActivated, or the override is not recognized. Please check the source code to cast IActivatedEventArgs to ProtocolActivatedEventArgs right here.
    Friday, May 16, 2014 12:12 PM