Skip to content
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

NRE in ExplicitInterfaceInvokerMethod constructor #1154

Open
espritm opened this issue Oct 25, 2023 · 3 comments
Open

NRE in ExplicitInterfaceInvokerMethod constructor #1154

espritm opened this issue Oct 25, 2023 · 3 comments
Labels
bug Component does not function as intended generator Issues binding a Java library (generator, class-parse, etc.)

Comments

@espritm
Copy link

espritm commented Oct 25, 2023

Android application type

.NET Android (net7.0-android, etc.)

Affected platform version

VSMac 17.6.3 (build 421)

Description

Trying to bind the following aar file, but I am stuck with the following error when I build

BINDINGSGENERATOR: Error BG0000: System.NullReferenceException: Object reference not set to an instance of an object. (BG0000)

sense-sdk-android-lib-3.28.0.zip

I also tried to add all dependencies as AndroidLibrary with Bind=false, but it does not fix the issue.

      net.zetetic:android-database-sqlcipher:3.5.9
      androidx.appcompat:appcompat:1.4.1
      androidx.biometric:biometric:1.1.0
      androidx.activity:activity:1.4.0
      androidx.fragment:fragment:1.4.1
      androidx.core:core:1.7.0
      androidx.annotation:annotation:1.3.0
      com.scottyab:rootbeer-lib:0.1.0 
      org.slf4j:slf4j-api:1.7.10
      com.google.code.gson:gson:2.8.7
      com.github.briandilley.jsonrpc4j:jsonrpc4j:1.0        
            com.fasterxml.jackson.core:jackson-core:2.0.2
            com.fasterxml.jackson.core:jackson-databind:2.0.2
            com.fasterxml.jackson.core:jackson-annotations:2.0.2
            javax.portlet:portlet-api:2.0
            javax.servlet:javax.servlet-api:3.1-b06
      commons-io:commons-io:2.4
      commons-lang:commons-lang:2.6
      org.apache.httpcomponents:httpcore:4.4.14

Steps to Reproduce

  1. Create a new Android Binding Library Project
  2. Add the .aar file
  3. Build -> We get the BG0000 error

Did you find any workaround?

No

Relevant log output


BINDINGSGENERATOR : error BG0000: System.NullReferenceException: Object reference not set to an instance of an object.
       at generator.SourceWriters.ExplicitInterfaceInvokerMethod..ctor(GenBase iface, Method method, CodeGenerationOptions opt) in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/tools/generator/SourceWriters/ExplicitInterfaceInvokerMethod.cs:line 26
       at generator.SourceWriters.ClassInvokerClass.AddMethodInvokers(ClassGen klass, IEnumerable`1 methods, HashSet`1 members, InterfaceGen gen, CodeGenerationOptions opt) in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/tools/generator/SourceWriters/ClassInvokerClass.cs:line 117
       at generator.SourceWriters.ClassInvokerClass.AddMemberInvokers(ClassGen klass, CodeGenerationOptions opt, HashSet`1 members) in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/tools/generator/SourceWriters/ClassInvokerClass.cs:line 73
       at generator.SourceWriters.ClassInvokerClass..ctor(ClassGen klass, CodeGenerationOptions opt) in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/tools/generator/SourceWriters/ClassInvokerClass.cs:line 67
       at generator.SourceWriters.BoundClass..ctor(ClassGen klass, CodeGenerationOptions opt, CodeGeneratorContext context, GenerationInfo generationInfo) in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/tools/generator/SourceWriters/BoundClass.cs:line 88
       at MonoDroid.Generation.JavaInteropCodeGenerator.WriteType(GenBase gen, String indent, GenerationInfo gen_info) in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/tools/generator/Java.Interop.Tools.Generator.CodeGeneration/JavaInteropCodeGenerator.cs:line 43
       at MonoDroid.Generation.ClassGen.Generate(CodeGenerationOptions opt, GenerationInfo gen_info) in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/tools/generator/Java.Interop.Tools.Generator.ObjectModel/ClassGen.cs:line 155
       at Xamarin.Android.Binder.CodeGenerator.Run(CodeGeneratorOptions options, DirectoryAssemblyResolver resolver) in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/tools/generator/CodeGenerator.cs:line 257
       at Xamarin.Android.Binder.CodeGenerator.Run(CodeGeneratorOptions options) in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/tools/generator/CodeGenerator.cs:line 50
       at Xamarin.Android.Binder.CodeGenerator.Main(String[] args) in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/tools/generator/CodeGenerator.cs:line 33
@espritm
Copy link
Author

espritm commented Oct 26, 2023

Hello @jonathanpeppers any chance you could have a idea ?

@jpobst
Copy link
Contributor

jpobst commented Oct 26, 2023

It looks like there is an issue with binding a few methods. I am still investigating why this happens, but it can be worked around by not binding the offending classes if they aren't needed, using the following Metadata xml:

<metadata>
  <remove-node path="/api/package[@name='ch.sysmosoft.shaded.com.fasterxml.jackson.databind.deser']/class[@name='SettableBeanProperty']" />
  <remove-node path="/api/package[@name='ch.sysmosoft.shaded.com.fasterxml.jackson.databind.ser']/class[@name='PropertyWriter']" />
</metadata>

@jpobst jpobst transferred this issue from dotnet/android Oct 26, 2023
@jpobst jpobst removed their assignment Oct 26, 2023
@jpobst jpobst added bug Component does not function as intended generator Issues binding a Java library (generator, class-parse, etc.) labels Oct 26, 2023
@jpobst jpobst changed the title BINDINGSGENERATOR: Error BG0000: System.NullReferenceException: Object reference not set to an instance of an object. (BG0000) [generator] NRE in ExplicitInterfaceInvokerMethod Oct 26, 2023
@jpobst jpobst changed the title [generator] NRE in ExplicitInterfaceInvokerMethod [generator] NRE in ExplicitInterfaceInvokerMethod constructor Oct 26, 2023
@jpobst jpobst changed the title [generator] NRE in ExplicitInterfaceInvokerMethod constructor NRE in ExplicitInterfaceInvokerMethod constructor Oct 26, 2023
@espritm
Copy link
Author

espritm commented Oct 27, 2023

Thank you jpobst ! I confirm it allow me to go ahead with the binding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Component does not function as intended generator Issues binding a Java library (generator, class-parse, etc.)
Projects
None yet
Development

No branches or pull requests

2 participants