Bug 21747 - Returning long[] as inout parameter from Android service doesn't result in expected values
Summary: Returning long[] as inout parameter from Android service doesn't result in ex...
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 4.12.4
Hardware: Macintosh Mac OS
: High normal
Target Milestone: ---
Assignee: Atsushi Eno
: 21748 ()
Depends on:
Reported: 2014-07-31 21:12 UTC by David Hathaway
Modified: 2014-08-05 05:08 UTC (History)
2 users (show)

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

Sample Repro (1.26 MB, application/zip)
2014-07-31 21:12 UTC, David Hathaway

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 Hathaway 2014-07-31 21:12:36 UTC
Created attachment 7557 [details]
Sample Repro

When binding to Java based Android Service from C#, the resulting long[] method parameter doesn't contain the expected values (repro attached).

Example AIDL:

/** Example service interface */
interface IDalvikSampleService {
    long longGetDevices(inout long[] devs, long dpmax);

Expected result:

Type: long, Position: 0, Value: 1
Type: long, Position: 1, Value: 2
Type: long, Position: 2, Value: 3
Type: long, Position: 3, Value: 4
Type: long, Position: 4, Value: 5

Actual result:

Type: long, Position: 0, Value: 21474836480
Type: long, Position: 1, Value: 1
Type: long, Position: 2, Value: 2
Type: long, Position: 3, Value: 3
Type: long, Position: 4, Value: 4

Android version is actually 4.12.6
Comment 1 Atsushi Eno 2014-08-01 15:11:48 UTC
How did you build sampleservice? I got some build failure after "android proejct update -p . && ant debug" :


[mergemanifest] No changes in the AndroidManifest files.
     [echo] Handling aidl files...
     [aidl] Found 1 AIDL files.
     [aidl] Compiling 1 AIDL files.
     [echo] ----------
     [echo] Handling RenderScript files...
     [echo] ----------
     [echo] Handling Resources...
     [aapt] Generating resource IDs...
     [aapt] invalid resource directory name: /home/atsushi/Desktop/bug21747/sampleservice/bin/res/crunch

/home/atsushi/android-sdk-linux/tools/ant/build.xml:653: The following error occurred while executing this line:
/home/atsushi/android-sdk-linux/tools/ant/build.xml:698: null returned: 1
Comment 2 David Hathaway 2014-08-01 17:04:27 UTC
I opened up Eclipse, added the project to my workspace, and then clicked Project > Build Project.  To run the service, I clicked Run > Run, and deployed to my emulator.

After successfully deploying to the emulator, I deployed the C# app from the sample repro on the same emulator and debugged.

No changes required to the solution after adding it to my workspace.

IDE Version Information:

Eclipse Standard/SDK

Version: Kepler Service Release 2
Build id: 20140224-0627

Android Development Toolkit

Comment 3 Atsushi Eno 2014-08-05 05:07:05 UTC
This is fixed and should be included in 4.18 or any alpha version for that.

Thanks for the repro for easy verification.

[monodroid master c2f54fb]
Comment 4 Atsushi Eno 2014-08-05 05:08:19 UTC
*** Bug 21748 has been marked as a duplicate of this bug. ***