Bug 45395 - Intent Handling interface implementations generate improper code
Summary: Intent Handling interface implementations generate improper code
Status: RESOLVED DUPLICATE of bug 39779
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: XI 10.0 (iOS10)
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2016-10-14 01:25 UTC by David Ortinau [MSFT]
Modified: 2016-10-14 13:43 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

environment details (1.83 KB, text/plain)
2016-10-14 01:25 UTC, David Ortinau [MSFT]

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description David Ortinau [MSFT] 2016-10-14 01:25:39 UTC
Created attachment 18040 [details]
environment details

I'm working with a Siri Intents Extension project. 

The default generated IntentHandler.cs shows methods that work fine. For example:

// Handle the completed intent (required).
        public void HandleSendMessage (INSendMessageIntent intent, Action<INSendMessageIntentResponse> completion)
            // Implement your application logic to send a message here.

            var userActivity = new NSUserActivity (nameof (INSendMessageIntent));
            var response = new INSendMessageIntentResponse (INSendMessageIntentResponseCode.Success, userActivity);
            completion (response);

However if I implement the IINSendMessageIntentHandling interface via the Xamarin Studio context menu, it generates:

public void HandleSendMessage (INSendMessageIntent intent, [BlockProxy (typeof (NIDActionArity1V67))] Action<INSendMessageIntentResponse> completion)
            throw new NotImplementedException ();

The same goes for other methods. I checked IINStartWorkoutIntentHandling specifically. We get that BlockProxy stuff added which probably doesn’t belong.

Removing the BlockProxy code, I can run successfully.
Comment 1 Sebastien Pouliot 2016-10-14 13:43:47 UTC
You're right. This is a known issue on the IDE side caused by a Roslyn bug [1].

Your workaround (to remove the internal attribute) is correct. XI's runtime will find the attribute on the base method and ensure the block gets marshalled correctly.

[1] https://github.com/dotnet/roslyn/issues/5646

*** This bug has been marked as a duplicate of bug 39779 ***