Bug 13074 - Create task based service references (.NET 4.5 Profile)
Summary: Create task based service references (.NET 4.5 Profile)
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: WCF assemblies ()
Version: unspecified
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2013-07-05 15:33 UTC by Neal
Modified: 2017-11-08 18:48 UTC (History)
6 users (show)

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

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 for Bug 13074 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Neal 2013-07-05 15:33:09 UTC

I have a WCF service that has a Task<bool> return type in the service Interface.  It would be great if when adding a service reference if you could support the newer .NET 4.5 System.Threading.Task based methods so we can use the async await pattern.  Presently XS doesn't know how to handle these service references with task based methods.  As you're adding async await (.NET 4.5) support in the upcoming release which I'm in the beta channel testing, having this available would be great.

Comment 1 Sebastian 2014-07-04 11:42:32 UTC
Are there any news or plans about this topic? This feature is even useful if you want to create a proxy reference for soap services that should use async/ await instead of events.
Comment 2 github 2017-10-04 10:30:35 UTC
The lack of support for Task-based service references manifests itself in InvalidOperationExceptions when sharing generated code with .Net Framework, even though the Xamarin code doesn't call the async method. See e.g. https://bugzilla.xamarin.com/show_bug.cgi?id=46917

When creating a channel, the contract description is generated, and the operation description for the async method throws an InvalidOperationException: Operation 'FooAsync' contains a message with parameters. Strongly-typed or untyped message can be paired only with strongly-typed, untyped or void message.

The source of the exception is https://github.com/mono/mono/blob/0bcbe39b148bb498742fc68416f8293ccd350fb6/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Dispatcher/OperationFormatter.cs#L515

It seems likely that the root cause is that MessageDescription.IsTypedMessage is returning false for the return type System.Threading.Tasks.Task<MyTypedMessage>.
Comment 4 Victor Milovanov 2017-11-08 18:48:28 UTC
OH, BTW, the issue is not limited to Mac OS. Android has the same problem, and probably iOS too.