-
Notifications
You must be signed in to change notification settings - Fork 529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AIDL file with method that uses a Map parameter causes build failure #1597
Comments
`Xamarin.Android.Tools.Aidl.CSharpCodeGenerator` didn't properly support unmarshaling the `Map` type, e.g. given a `Test.aidl` file with the Build action `@(AndroidInterfaceDescription)`: import java.util; interface Test { void arrayList(inout List list); void map(inout Map m); } the build would fail with: obj/Debug/aidl/Test.cs(57,17): error CS7036: There is no argument given that corresponds to the required formal parameter 'loader' of 'Parcel.ReadHashMap(ClassLoader)' obj/Debug/aidl/Test.cs(98,21): error CS7036: There is no argument given that corresponds to the required formal parameter 'outVal' of 'Parcel.ReadList(IList, ClassLoader)' obj/Debug/aidl/Test.cs(118,18): error CS7036: There is no argument given that corresponds to the required formal parameter 'outVal' of 'Parcel.ReadMap(IDictionary, ClassLoader)' in which the lines 56-57 are: Android.Runtime.JavaDictionary arg0 = default (Android.Runtime.JavaDictionary); arg0 = data.ReadHashMap (); // error CS7036 Lines 94-98 are: __data.WriteInterfaceToken (descriptor); __data.WriteList (list); remote.Transact (ITestStub.TransactionArrayList, __data, __reply, 0); __reply.ReadException (); list = __reply.ReadList (); // error CS7036 Lines 114-118 are: __data.WriteInterfaceToken (descriptor); __data.WriteMap (m); remote.Transact (ITestStub.TransactionMap, __data, __reply, 0); __reply.ReadException (); m = __reply.ReadMap (); // error CS7036 Fix `Map` marshaling and update `List` marshaling for `inout` and `out` parameters, so that `data.ReadHashMap()` appropriately passes `null` for the `ClassLoader` parameter: arg0 = (global::Android.Runtime.JavaDictionary) data.ReadHashMap ((global::Java.Lang.ClassLoader) null); and `inout`/`out` parameters use the appropriate `Parcel.Read*()` methods: __reply.ReadList (list, (global::Java.Lang.ClassLoader) null); __reply.ReadMap (m, (global::Java.Lang.ClassLoader) null); Note: to run the unit test fixture for *just* the AIDL tests, use: msbuild Xamarin.Android.sln /t:RunNUnitTests /p:Test=Xamarin.Android.Build.Tests.AidlTest The `RunNUnitTests` target has been updated so that it works as intended.
Fixes: dotnet#1597 `Xamarin.Android.Tools.Aidl.CSharpCodeGenerator` didn't properly support unmarshaling the `Map` type, e.g. given a `Test.aidl` file with the Build action `@(AndroidInterfaceDescription)`: import java.util; interface Test { void arrayList(inout List list); void map(inout Map m); } the build would fail with: obj/Debug/aidl/Test.cs(57,17): error CS7036: There is no argument given that corresponds to the required formal parameter 'loader' of 'Parcel.ReadHashMap(ClassLoader)' obj/Debug/aidl/Test.cs(98,21): error CS7036: There is no argument given that corresponds to the required formal parameter 'outVal' of 'Parcel.ReadList(IList, ClassLoader)' obj/Debug/aidl/Test.cs(118,18): error CS7036: There is no argument given that corresponds to the required formal parameter 'outVal' of 'Parcel.ReadMap(IDictionary, ClassLoader)' in which the lines 56-57 are: Android.Runtime.JavaDictionary arg0 = default (Android.Runtime.JavaDictionary); arg0 = data.ReadHashMap (); // error CS7036 Lines 94-98 are: __data.WriteInterfaceToken (descriptor); __data.WriteList (list); remote.Transact (ITestStub.TransactionArrayList, __data, __reply, 0); __reply.ReadException (); list = __reply.ReadList (); // error CS7036 Lines 114-118 are: __data.WriteInterfaceToken (descriptor); __data.WriteMap (m); remote.Transact (ITestStub.TransactionMap, __data, __reply, 0); __reply.ReadException (); m = __reply.ReadMap (); // error CS7036 Fix `Map` marshaling and update `List` marshaling for `inout` and `out` parameters, so that `data.ReadHashMap()` appropriately passes `null` for the `ClassLoader` parameter: arg0 = (global::Android.Runtime.JavaDictionary) data.ReadHashMap ((global::Java.Lang.ClassLoader) null); and `inout`/`out` parameters use the appropriate `Parcel.Read*()` methods: __reply.ReadList (list, (global::Java.Lang.ClassLoader) null); __reply.ReadMap (m, (global::Java.Lang.ClassLoader) null); Note: to run the unit test fixture for *just* the AIDL tests, use: msbuild Xamarin.Android.sln /t:RunNUnitTests /p:Test=Xamarin.Android.Build.Tests.AidlTest The `RunNUnitTests` target has been updated so that it works as intended.
Fixes: #1597 `Xamarin.Android.Tools.Aidl.CSharpCodeGenerator` didn't properly support unmarshaling the `Map` type, e.g. given a `Test.aidl` file with the Build action `@(AndroidInterfaceDescription)`: import java.util; interface Test { void arrayList(inout List list); void map(inout Map m); } the build would fail with: obj/Debug/aidl/Test.cs(57,17): error CS7036: There is no argument given that corresponds to the required formal parameter 'loader' of 'Parcel.ReadHashMap(ClassLoader)' obj/Debug/aidl/Test.cs(98,21): error CS7036: There is no argument given that corresponds to the required formal parameter 'outVal' of 'Parcel.ReadList(IList, ClassLoader)' obj/Debug/aidl/Test.cs(118,18): error CS7036: There is no argument given that corresponds to the required formal parameter 'outVal' of 'Parcel.ReadMap(IDictionary, ClassLoader)' in which the lines 56-57 are: Android.Runtime.JavaDictionary arg0 = default (Android.Runtime.JavaDictionary); arg0 = data.ReadHashMap (); // error CS7036 Lines 94-98 are: __data.WriteInterfaceToken (descriptor); __data.WriteList (list); remote.Transact (ITestStub.TransactionArrayList, __data, __reply, 0); __reply.ReadException (); list = __reply.ReadList (); // error CS7036 Lines 114-118 are: __data.WriteInterfaceToken (descriptor); __data.WriteMap (m); remote.Transact (ITestStub.TransactionMap, __data, __reply, 0); __reply.ReadException (); m = __reply.ReadMap (); // error CS7036 Fix `Map` marshaling and update `List` marshaling for `inout` and `out` parameters, so that `data.ReadHashMap()` appropriately passes `null` for the `ClassLoader` parameter: arg0 = (global::Android.Runtime.JavaDictionary) data.ReadHashMap ((global::Java.Lang.ClassLoader) null); and `inout`/`out` parameters use the appropriate `Parcel.Read*()` methods: __reply.ReadList (list, (global::Java.Lang.ClassLoader) null); __reply.ReadMap (m, (global::Java.Lang.ClassLoader) null); Note: to run the unit test fixture for *just* the AIDL tests, use: msbuild Xamarin.Android.sln /t:RunNUnitTests /p:Test=Xamarin.Android.Build.Tests.AidlTest The `RunNUnitTests` target has been updated so that it works as intended.
Fixes: #1597 `Xamarin.Android.Tools.Aidl.CSharpCodeGenerator` didn't properly support unmarshaling the `Map` type, e.g. given a `Test.aidl` file with the Build action `@(AndroidInterfaceDescription)`: import java.util; interface Test { void arrayList(inout List list); void map(inout Map m); } the build would fail with: obj/Debug/aidl/Test.cs(57,17): error CS7036: There is no argument given that corresponds to the required formal parameter 'loader' of 'Parcel.ReadHashMap(ClassLoader)' obj/Debug/aidl/Test.cs(98,21): error CS7036: There is no argument given that corresponds to the required formal parameter 'outVal' of 'Parcel.ReadList(IList, ClassLoader)' obj/Debug/aidl/Test.cs(118,18): error CS7036: There is no argument given that corresponds to the required formal parameter 'outVal' of 'Parcel.ReadMap(IDictionary, ClassLoader)' in which the lines 56-57 are: Android.Runtime.JavaDictionary arg0 = default (Android.Runtime.JavaDictionary); arg0 = data.ReadHashMap (); // error CS7036 Lines 94-98 are: __data.WriteInterfaceToken (descriptor); __data.WriteList (list); remote.Transact (ITestStub.TransactionArrayList, __data, __reply, 0); __reply.ReadException (); list = __reply.ReadList (); // error CS7036 Lines 114-118 are: __data.WriteInterfaceToken (descriptor); __data.WriteMap (m); remote.Transact (ITestStub.TransactionMap, __data, __reply, 0); __reply.ReadException (); m = __reply.ReadMap (); // error CS7036 Fix `Map` marshaling and update `List` marshaling for `inout` and `out` parameters, so that `data.ReadHashMap()` appropriately passes `null` for the `ClassLoader` parameter: arg0 = (global::Android.Runtime.JavaDictionary) data.ReadHashMap ((global::Java.Lang.ClassLoader) null); and `inout`/`out` parameters use the appropriate `Parcel.Read*()` methods: __reply.ReadList (list, (global::Java.Lang.ClassLoader) null); __reply.ReadMap (m, (global::Java.Lang.ClassLoader) null); Note: to run the unit test fixture for *just* the AIDL tests, use: msbuild Xamarin.Android.sln /t:RunNUnitTests /p:Test=Xamarin.Android.Build.Tests.AidlTest The `RunNUnitTests` target has been updated so that it works as intended.
Release status update A new Preview version of Xamarin.Android has now been published that includes the fix for this item. The fix is not yet included in a Release version. I will update this item again when a Release version is available that includes the fix. Fix included in Xamarin.Android SDK version 11.1.0.3. Fix included on Windows in Visual Studio 2019 version 16.8 Preview 3. To try the Preview version that includes the fix, check for the latest updates in Visual Studio Preview. Fix included on macOS in Visual Studio 2019 for Mac version 8.8 Preview 3. To try the Preview version that includes the fix, check for the latest updates on the Preview updater channel. |
Release status update A new Release version of Xamarin.Android has now been published that includes the fix for this item. Fix included in Xamarin.Android SDK version 11.1.0.17. Fix included on Windows in Visual Studio 2019 version 16.8. To get the new version that includes the fix, check for the latest updates or install the most recent release from https://visualstudio.microsoft.com/downloads/. Fix included on macOS in Visual Studio 2019 for Mac version 8.8. To get the new version that includes the fix, check for the latest updates on the Stable updater channel. |
When building the attached test project, the build fails with error:
/path/to/obj/Debug/aidl/IMxFrameworkService.cs(17,17): Error CS7036: There is no argument given that corresponds to the required formal parameter 'loader' of 'Parcel.ReadHashMap(ClassLoader)' (CS7036) (MobileAndroid)
The
IMxFrameworkService.cs
is the file generated from the AIDL file. There is this line of code in theOnTransact
method:arg1 = data.ReadHashMap ();
Note that there is no
ClassLoader
parameter. In theAndroid.OS.Parcel
class, there is only one overload for theReadHashMap
method and it takes aClassLoader
(an abstract class) as an argument. There is no overload that takes no arguments.Steps to Reproduce
Microsoft-118042018043876.zip
Expected Behavior
Project will build
Actual Behavior
build fails with error noted above.
Version Information
=== Visual Studio Enterprise 2017 for Mac ===
Version 7.4.3 (build 10)
Installation UUID: f86726f2-bd5d-4610-867e-44e82f306ca2
Runtime:
Mono 5.8.1.0 (2017-10/6bf3922f3fd) (64-bit)
GTK+ 2.24.23 (Raleigh theme)
=== NuGet ===
Version: 4.3.1.4445
=== .NET Core ===
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
2.0.5
2.0.0
1.1.1
1.0.4
1.0.0
SDK: /usr/local/share/dotnet/sdk/2.1.4/Sdks
SDK Versions:
2.1.4
2.0.0
1.0.1
1.0.0-preview2-003121
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.8.1/lib/mono/msbuild/15.0/bin/Sdks
=== Xamarin.Profiler ===
Version: 1.6.1
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
=== Xamarin.Android ===
Version: 8.2.0.16 (Visual Studio Enterprise)
Android SDK: /Users/jongoldberger/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
4.0.3 (API level 15)
4.1 (API level 16)
4.2 (API level 17)
4.3 (API level 18)
4.4 (API level 19)
5.0 (API level 21)
5.1 (API level 22)
6.0 (API level 23)
7.0 (API level 24)
7.1 (API level 25)
8.0 (API level 26)
8.1 (API level 27)
SDK Tools Version: 26.1.1
SDK Platform Tools Version: 27.0.1
SDK Build Tools Version: 27.0.3
Java SDK: /usr
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL
=== Apple Developer Tools ===
Xcode 9.3 (14154)
Build 9E145
=== Xamarin.Mac ===
Version: 4.2.1.29 (Visual Studio Enterprise)
=== Xamarin.iOS ===
Version: 11.9.1.24 (Visual Studio Enterprise)
Hash: f62de472
Branch: xcode9.3
Build date: 2018-03-29 19:30:53-0400
=== Xamarin Inspector ===
Version: 1.4.0
Hash: b3f92f9
Branch: master
Build date: Fri, 19 Jan 2018 22:00:34 GMT
Client compatibility: 1
=== Build Information ===
Release ID: 704030010
Git revision: 5af3e98549653fcc5335896ccc296343d08f31bb
Build date: 2018-04-12 12:32:07-04
Xamarin addins: fadb82fb0fe2668cb7789f8b524aec6fb8568ee7
Build lane: monodevelop-lion-d15-6
=== Operating System ===
Mac OS X 10.13.4
Darwin 17.5.0 Darwin Kernel Version 17.5.0
Mon Mar 5 22:24:32 PST 2018
root:xnu-4570.51.1~1/RELEASE_X86_64 x86_64
=== Enabled user installed addins ===
Internet of Things (IoT) development (Preview) 7.1
Log File
Build_Log.txt
reported in (for my reference)
SR 118042018043876
The text was updated successfully, but these errors were encountered: