Bug 35744 - Android Support v4 throws Null Reference Exception when set as a ReferenceJar/EmbeddedReferenceJar
Summary: Android Support v4 throws Null Reference Exception when set as a ReferenceJar...
Alias: None
Product: Android
Classification: Xamarin
Component: Bindings ()
Version: 6.0.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Atsushi Eno
Depends on:
Reported: 2015-11-10 13:26 UTC by Jon Douglas [MSFT]
Modified: 2016-03-03 15:58 UTC (History)
2 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 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 Jon Douglas [MSFT] 2015-11-10 13:26:19 UTC

When trying to reference the Android Support v4.jar or the respective Xamarin.Android.Support.v4 NuGet package, the respective Bindings project throws a:

Error	"generator.exe" exited with code -1073741819.	ZendeskSDK.Android	C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Bindings.targets Line 380

Further Investigation shows that the Diagnostic Build Output has a NRE:

1>   (TaskId:66)
1>  Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object. (TaskId:66)
1>     at MonoDroid.Generation.Parameter.get_Type() (TaskId:66)
1>     at MonoDroid.Generation.GenBase.<AutoDetectEnumifiedOverrideParameters>m__8(Parameter p) (TaskId:66)
1>     at System.Linq.Enumerable.All[TSource](IEnumerable`1 source, Func`2 predicate) (TaskId:66)
1>     at MonoDroid.Generation.GenBase.AutoDetectEnumifiedOverrideParameters(MethodBase method, CodeGenerationOptions opt) (TaskId:66)
1>     at MonoDroid.Generation.GenBase.UpdateEnums(CodeGenerationOptions opt) (TaskId:66)
1>     at MonoDroid.Generation.GenBase.UpdateEnums(CodeGenerationOptions opt) (TaskId:66)
1>     at Xamarin.Android.Binder.CodeGenerator.Run(CodeGeneratorOptions options) (TaskId:66)
1>     at Xamarin.Android.Binder.CodeGenerator.Main(String[] args) (TaskId:66)
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Bindings.targets(380,5): error MSB6006: "generator.exe" exited with code -1073741819.
1>Done executing task "BindingsGenerator" -- FAILED. (TaskId:66)
1>Done building target "GenerateBindings" in project "ZendeskSDK.Android.csproj" -- FAILED.: (TargetId:43)

Since this error message does not give any insight to the problem at hand, I believe this might be an issue in the actual Binder CodeGenerator.



Note: This reproduction uses the method of using "ReferenceJar/EmbeddedReferenceJar" as the build action with the android.support.v4.jar. This will also occur if you exclude the support.v4 jar from the project and add the Xamarin.Android.Support.v4 NuGet package to the project.

*Version Information:

Microsoft Visual Studio Professional 2015
Version 14.0.23107.0 D14REL
Microsoft .NET Framework
Version 4.6.00079

Installed Version: Professional

NuGet Package Manager   3.0.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

Xamarin (90e1af2)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android (9d7074e)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS (9ce9e8b)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 1 Atsushi Eno 2015-11-11 06:06:59 UTC
The crasher is fixed in monodroid master. Thanks.

Though whenever you expose those types in the support libraries via the public members of your libraries, you should immediately stop using EmbeddedReferenceJar and switch to reference to support library binding dlls (basically you always should whenever the Java library depends on those support libs).

[master 08b50e6]
Comment 2 Atsushi Eno 2015-11-16 00:28:07 UTC
(Actually I made mistake and the mentioned commit didn't go to master; it is now [master d655d6b].)
Comment 3 Richard Massé 2016-03-03 15:24:31 UTC
Does the patch is available now, i am still unable to build my binding project.

Comment 4 Atsushi Eno 2016-03-03 15:58:55 UTC
Our Alpha channel release should contain the fix.