Bug 59046 - Bindings Generator fails with [ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentNullException: Value cannot be null.
Summary: Bindings Generator fails with [ERROR] FATAL UNHANDLED EXCEPTION: System.Argu...
Status: CONFIRMED
Alias: None
Product: Android
Classification: Xamarin
Component: Bindings (show other bugs)
Version: 7.4 (15.3)
Hardware: PC Mac OS
: --- normal
Target Milestone: 15.7
Assignee: Atsushi Eno
URL:
Depends on:
Blocks:
 
Reported: 2017-08-25 16:51 UTC by Tom Opgenorth
Modified: 2018-03-14 08:56 UTC (History)
5 users (show)

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


Attachments
Diagnostic build output from VS4M (295.26 KB, text/plain)
2017-08-25 16:52 UTC, Tom Opgenorth
Details
FirebaseJobDispatcher binding solution. (1.88 MB, application/zip)
2017-08-25 16:59 UTC, Tom Opgenorth
Details


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 59046 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:
CONFIRMED

Description Tom Opgenorth 2017-08-25 16:51:30 UTC
Trying to update the Firebsse Job Dispatcher binding for Xamarin.Android. The underlying Android library has been updated from v0.7.0 to 0.8.0. When trying to build the binding, it seems the binding generator is throwing a System.ArgumentNullException.   This did not happen in the previous iterations of the binding.  


 Unhandled Exception:
    System.ArgumentNullException: Value cannot be null.
    Parameter name: source
      at System.Linq.Enumerable.Select[TSource,TResult] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] selector) [0x0000d] in <9da65c3aa2654e53b5f11b79677182e0>:0 
      at Xamarin.AndroidTools.AnnotationSupport.DefinitionManagedTypeFinderExtension.ProcessAnnotationValue (Xamarin.AndroidTools.AnnotationSupport.AnnotatedItem item, Xamarin.AndroidTools.AnnotationSupport.AnnotationData a, Xamarin.AndroidTools.AnnotationSupport.AnnotationValue v) [0x00082] in <08f29b842a824ce4bb0f2f6f47ddd0af>:0 
      at Xamarin.AndroidTools.AnnotationSupport.DefinitionManagedTypeFinderExtension.ProcessAnnotation (Xamarin.AndroidTools.AnnotationSupport.AnnotatedItem item) [0x00075] in <08f29b842a824ce4bb0f2f6f47ddd0af>:0 
      at Xamarin.AndroidTools.AnnotationSupport.ManagedTypeFinder.LoadManagedMappings (System.Collections.Generic.IEnumerable`1[T] anns, Xamarin.AndroidTools.AnnotationSupport.ManagedTypeFinder+IType[] types) [0x0015e] in <08f29b842a824ce4bb0f2f6f47ddd0af>:0 
      at Xamarin.AndroidTools.AnnotationSupport.ManagedTypeFinderGeneratorTypeSystem.OnAnnotationsParsed (System.Collections.Generic.IEnumerable`1[T] itemsToBeBound) [0x00032] in <04bcf7d07cca48eb8ff9a9b3c45408ea>:0 
      at Xamarin.AndroidTools.AnnotationSupport.AndroidAnnotationsSupport.Load (System.String annotationsZipFile) [0x0001b] in <08f29b842a824ce4bb0f2f6f47ddd0af>:0 
      at Xamarin.Android.Binder.CodeGenerator.GenerateAnnotationAttributes (System.Collections.Generic.List`1[T] gens, System.Collections.Generic.IEnumerable`1[T] zips) [0x00047] in <04bcf7d07cca48eb8ff9a9b3c45408ea>:0 
      at Xamarin.Android.Binder.CodeGenerator.Run (Xamarin.Android.Binder.CodeGeneratorOptions options, Java.Interop.Tools.Cecil.DirectoryAssemblyResolver resolver) [0x0055e] in <04bcf7d07cca48eb8ff9a9b3c45408ea>:0 
      at Xamarin.Android.Binder.CodeGenerator.Run (Xamarin.Android.Binder.CodeGeneratorOptions options) [0x00029] in <04bcf7d07cca48eb8ff9a9b3c45408ea>:0 
      at Xamarin.Android.Binder.CodeGenerator.Main (System.String[] args) [0x00014] in <04bcf7d07cca48eb8ff9a9b3c45408ea>:0 
    [ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentNullException: Value cannot be null.
    Parameter name: source
      at System.Linq.Enumerable.Select[TSource,TResult] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] selector) [0x0000d] in <9da65c3aa2654e53b5f11b79677182e0>:0 
      at Xamarin.AndroidTools.AnnotationSupport.DefinitionManagedTypeFinderExtension.ProcessAnnotationValue (Xamarin.AndroidTools.AnnotationSupport.AnnotatedItem item, Xamarin.AndroidTools.AnnotationSupport.AnnotationData a, Xamarin.AndroidTools.AnnotationSupport.AnnotationValue v) [0x00082] in <08f29b842a824ce4bb0f2f6f47ddd0af>:0 
      at Xamarin.AndroidTools.AnnotationSupport.DefinitionManagedTypeFinderExtension.ProcessAnnotation (Xamarin.AndroidTools.AnnotationSupport.AnnotatedItem item) [0x00075] in <08f29b842a824ce4bb0f2f6f47ddd0af>:0 
      at Xamarin.AndroidTools.AnnotationSupport.ManagedTypeFinder.LoadManagedMappings (System.Collections.Generic.IEnumerable`1[T] anns, Xamarin.AndroidTools.AnnotationSupport.ManagedTypeFinder+IType[] types) [0x0015e] in <08f29b842a824ce4bb0f2f6f47ddd0af>:0 
      at Xamarin.AndroidTools.AnnotationSupport.ManagedTypeFinderGeneratorTypeSystem.OnAnnotationsParsed (System.Collections.Generic.IEnumerable`1[T] itemsToBeBound) [0x00032] in <04bcf7d07cca48eb8ff9a9b3c45408ea>:0 
      at Xamarin.AndroidTools.AnnotationSupport.AndroidAnnotationsSupport.Load (System.String annotationsZipFile) [0x0001b] in <08f29b842a824ce4bb0f2f6f47ddd0af>:0 
      at Xamarin.Android.Binder.CodeGenerator.GenerateAnnotationAttributes (System.Collections.Generic.List`1[T] gens, System.Collections.Generic.IEnumerable`1[T] zips) [0x00047] in <04bcf7d07cca48eb8ff9a9b3c45408ea>:0 
      at Xamarin.Android.Binder.CodeGenerator.Run (Xamarin.Android.Binder.CodeGeneratorOptions options, Java.Interop.Tools.Cecil.DirectoryAssemblyResolver resolver) [0x0055e] in <04bcf7d07cca48eb8ff9a9b3c45408ea>:0 
      at Xamarin.Android.Binder.CodeGenerator.Run (Xamarin.Android.Binder.CodeGeneratorOptions options) [0x00029] in <04bcf7d07cca48eb8ff9a9b3c45408ea>:0 
      at Xamarin.Android.Binder.CodeGenerator.Main (System.String[] args) [0x00014] in <04bcf7d07cca48eb8ff9a9b3c45408ea>:0 
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Bindings.targets(438,5): error MSB6006: "generator" exited with code 1.

Please see around line 3665 in the attached file, build-log.txt. 

Steps to Duplicate:

1. Build the CSPROJ file in Visual Studio for Mac for the Binding Library project. The source for this binding project can be found in the XamarinComponents Github repo at https://github.com/xamarin/XamarinComponents/tree/master/Android/FirebaseJobDispatcher. This update is being done in a branch, toopge-FJD-0-8-0. The source code for this binding is at https://github.com/xamarin/XamarinComponents/tree/toopge-FJD-0-8-0/Android/FirebaseJobDispatcher/source/Firebase.JobDispatcher.  Will try to attach the complete solution to this issue as well.



Visual Studio for Mac information: 
=== Visual Studio Enterprise 2017 for Mac ===

Version 7.1 (build 1297)
Installation UUID: ef2cd217-c6d2-4b3a-8525-cd01cc0c9e21
Runtime:
	Mono 5.2.0.215 (d15-3/da80840) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 502000215

=== NuGet ===

Version: 4.3.0.2418

=== .NET Core ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
	1.1.2
	1.0.5
SDK: /usr/local/share/dotnet/sdk/1.0.4/Sdks
SDK Version: 1.0.4
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/msbuild/15.0/bin/Sdks

=== Xamarin.Profiler ===

Version: 1.5.5
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Apple Developer Tools ===

Xcode 8.3.3 (12175.1)
Build 8E3004b

=== Xamarin.iOS ===

Version: 10.12.0.20 (Visual Studio Enterprise)
Hash: 80b8487d
Branch: d15-3
Build date: 2017-08-18 16:07:26-0400

=== Xamarin.Android ===

Version: 7.4.0.21 (Visual Studio Enterprise)
Android SDK: /Users/tom/Library/Android/sdk
	Supported Android versions:
		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)

SDK Tools Version: 26.0.2
SDK Platform Tools Version: 26.0.0
SDK Build Tools Version: 26.0.1

Java SDK: /usr
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Xamarin.Mac ===

Version: 3.6.0.19 (Visual Studio Enterprise)

=== Xamarin Inspector ===

Version: 1.2.2
Hash: b71b035
Branch: d15-1
Build date: Fri, 21 Apr 2017 17:57:12 GMT

=== Build Information ===

Release ID: 701001297
Git revision: 9c5299666538b2f8baf501418a5c064d784d64da
Build date: 2017-08-07 11:29:35-04
Xamarin addins: 3bb0c32a14f1b7e368bf5ac53a84c3581c019391
Build lane: monodevelop-lion-d15-3

=== Operating System ===

Mac OS X 10.12.6
Darwin 16.7.0 Darwin Kernel Version 16.7.0
    Thu Jun 15 17:36:27 PDT 2017
    root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64
Comment 1 Tom Opgenorth 2017-08-25 16:52:09 UTC
Created attachment 24420 [details]
Diagnostic build output from VS4M
Comment 2 Tom Opgenorth 2017-08-25 16:59:10 UTC
Created attachment 24421 [details]
FirebaseJobDispatcher binding solution.

This should include the AAR to be bound, the binding project, and a sample project. It should be ready to build from within VS4M.
Comment 3 Jon Douglas [MSFT] 2017-08-25 17:58:00 UTC
I can CONFIRM that this behavior fails in both jar2xml and class-parse scenarios. It seems to be a failure in the AnnotationSupport. Specifically:

https://github.com/xamarin/java.interop/blob/a1d3ecc8ba6e67b96ae1c633194b0e78c2ac5c23/src/Xamarin.Android.Tools.AnnotationSupport/ManagedTypeFinders/DefinitionManagedTypeFinderExtension.cs#L36

This occurs in both Xamarin.Android 7.4.0.21 and Xamarin.Android 7.5.0.3
Comment 4 Tom Opgenorth 2017-09-15 13:53:02 UTC
Can I ask about the status of this bug? 

Trying to update the Firebase Job Dispatcher bindings to at least use more recent versions of the various Android packages, this still keeps happening.

I've updated VS4M from the stable channel, current running Xamarin.Android 7.4.3.1 and VS4M 7.1.3 (build 1).

I tried commenting out all of my metadata.xml, and I still get this error (in addition to a couple of other that I would have expected from not having the meteadata necessary  for the binding to build).
Comment 5 Tom Opgenorth 2017-09-15 13:53:44 UTC
Full information about my VS4M installation:

=== Visual Studio Enterprise 2017 for Mac ===

Version 7.1.3 (build 1)
Installation UUID: ef2cd217-c6d2-4b3a-8525-cd01cc0c9e21
Runtime:
	Mono 5.2.0.224 (d15-3/14f2c81) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 502000224

=== NuGet ===

Version: 4.3.0.2418

=== .NET Core ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
	1.1.2
	1.0.5
SDK: /usr/local/share/dotnet/sdk/1.0.4/Sdks
SDK Version: 1.0.4
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/msbuild/15.0/bin/Sdks

=== Xamarin.Profiler ===

Version: 1.5.5
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Xamarin.Android ===

Version: 7.4.3.1 (Visual Studio Enterprise)
Android SDK: /Users/tom/Library/Android/sdk
	Supported Android versions:
		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)

SDK Tools Version: 26.0.2
SDK Platform Tools Version: 26.0.0
SDK Build Tools Version: 26.0.1

Java SDK: /usr
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Apple Developer Tools ===

Xcode 8.3.3 (12175.1)
Build 8E3004b

=== Xamarin.iOS ===

Version: 10.12.3.3 (Visual Studio Enterprise)
Hash: 8a391069
Branch: d15-3
Build date: 2017-08-28 16:51:11-0400

=== Xamarin Inspector ===

Version: 1.3.0
Hash: 8c298a5
Branch: 1.3-release
Build date: Thu, 14 Sep 2017 21:21:26 GMT
Client compatibility: 1

=== Xamarin.Mac ===

Version: 3.6.3.3 (Visual Studio Enterprise)

=== Build Information ===

Release ID: 701030001
Git revision: ba94259b26824844f4d2c76c794738eb75b85726
Build date: 2017-08-25 16:28:43-04
Xamarin addins: ee499cfb63ae406b1e394bf6a159ad2953f7fab6
Build lane: monodevelop-lion-d15-3

=== Operating System ===

Mac OS X 10.12.6
Darwin 16.7.0 Darwin Kernel Version 16.7.0
    Thu Jun 15 17:36:27 PDT 2017
    root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64
Comment 6 Tom Opgenorth 2017-10-10 20:06:57 UTC
Just tried to rebuild the Firebase Job Dispatcher binding using 15.4, updating the NuGet dependencies, and targeting API level 26 (Android 8.0). Could not duplicate this error.

Here is information about my version of Visual Studio for Mac:

=== Visual Studio Enterprise 2017 for Mac ===

Version 7.2 (build 636)
Installation UUID: ef2cd217-c6d2-4b3a-8525-cd01cc0c9e21
Runtime:
	Mono 5.4.0.201 (2017-06/71277e78f6e) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 504000201

=== NuGet ===

Version: 4.3.1.4445

=== .NET Core ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
	1.1.2
	1.0.5
SDK: /usr/local/share/dotnet/sdk/1.0.4/Sdks
SDK Version: 1.0.4
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.4.0/lib/mono/msbuild/15.0/bin/Sdks

=== Xamarin.Profiler ===

Version: 1.5.6
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Xamarin.Android ===

Version: 8.0.0.33 (Visual Studio Enterprise)
Android SDK: /Users/tom/Library/Android/sdk
	Supported Android versions:
		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)

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 26.0.1
SDK Build Tools Version: 26.0.2

Java SDK: /usr
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Apple Developer Tools ===

Xcode 9.0 (13247)
Build 9A235

=== Xamarin.iOS ===

Version: 11.2.0.11 (Visual Studio Enterprise)
Hash: 2f8bbec0
Branch: d15-4-xi
Build date: 2017-10-05 20:56:05-0400

=== Xamarin Inspector ===

Version: 1.3.2
Hash: 461f09a
Branch: 1.3-release
Build date: Tue, 03 Oct 2017 18:26:57 GMT
Client compatibility: 1

=== Xamarin.Mac ===

Version: 3.8.0.49 (Visual Studio Enterprise)

=== Build Information ===

Release ID: 702000636
Git revision: b349c8fc0c2e1aab0179917d56eed75eb3a03337
Build date: 2017-10-06 15:20:04-04
Xamarin addins: a8da992c78f7eb65b3cdb3f951c34a30337cab35
Build lane: monodevelop-lion-d15-4

=== Operating System ===

Mac OS X 10.12.6
Darwin 16.7.0 Darwin Kernel Version 16.7.0
    Thu Jun 15 17:36:27 PDT 2017
    root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64
Comment 7 Tom Opgenorth 2017-10-11 14:08:14 UTC
Tried again this morning with a Rebuild All in Visual Studio for Mac, and the error is occurring again.
Comment 8 Jon Dick 2017-10-11 15:02:29 UTC
It seems to be the fact that the .aar file contains an annotations.zip (with an annotations.xml file in it of: https://gist.github.com/Redth/7a379f06489200c4dede10abb8c9c9fb ).

The generator is hitting a null reference exception somewhere in the parsing of that file.
Comment 9 Atsushi Eno 2018-03-14 08:56:49 UTC
https://github.com/xamarin/java.interop/pull/272