Bug 34766 - Allow setting return types to void
Summary: Allow setting return types to void
Status: ASSIGNED
Alias: None
Product: Android
Classification: Xamarin
Component: Bindings ()
Version: unspecified
Hardware: All All
: Low enhancement
Target Milestone: master
Assignee: Atsushi Eno
URL:
Depends on:
Blocks:
 
Reported: 2015-10-12 12:12 UTC by Matthew Leibowitz
Modified: 2016-09-21 13:31 UTC (History)
2 users (show)

Tags: XATriaged
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 34766 on Developer Community or GitHub 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: Developer Community HTML or GitHub Markdown
  • 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:
Status:
ASSIGNED

Description Matthew Leibowitz 2015-10-12 12:12:36 UTC
When binding Android libraries, I often come across the Java pattern:

class Mine {
  int GetNumber();
  Mine setNumber(int);
}

In C#, we would have a single Number property.

It would be great to be able to set the managedReturn value to 'void'.

Currently if I do, then the property is created, but the code in the setter is invalid:

  ...
  void __ret = Java.Lang.Object.GetObject<Mine> (...);
  return __ret;
  ...

It seems that in the special case of void, the result can be ignored?
Comment 1 Atsushi Eno 2015-10-12 22:30:47 UTC
I don't quite understand why you need managedReturn there while those methods should be already converted to a property... ?
Comment 2 Atsushi Eno 2015-10-12 22:36:51 UTC
oh, never mind, your setter doesn't return void. Well, managedReturn doesn't do the trick either. It never changes how JNI invocation works (if we change that, that will break any internal invocations and causes run-time crash, which 100% users don't want).

Supporting fluent method setters is a different issue and it is so far unsupported by design, while we _might_ be adding at some stage. If I remember correctly it was discussed in last August Android meeting.