Skip to content
This repository was archived by the owner on Aug 27, 2026. It is now read-only.
This repository was archived by the owner on Aug 27, 2026. It is now read-only.

Bindingsgenerator stops recognizing C# types #543

Closed

Description

@MFinkBK

I have a bindings project where we bind a Brother Printer SDK library. Starting with VS 2019 16.4.0 we get warnings about missing managed types. This is the first line of about 30:

warning BG8800: Unknown parameter type System.Collections.Generic.IList<Java.Util.Locale.LanguageRange> in method Filter in managed type Java.Util.Locale.

Compiling and linking with the app project works fine, no further warnings. I can attach the whole log if needed.

I checked the msbuild output and saw the call to the generator.exe in the Xamarin Android folder (formatted for readability):

"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\Android\generator.exe" ^
 obj\Debug\api.xml ^
 --codegen-target=XAJavaInterop1 ^
 --csdir=obj\Debug\generated\src ^
 --enumdir=obj\Debug\generated\enums ^
 --enummetadata=obj\Debug\generated\metadata ^
 --assembly=BrotherSDK.Android ^
 --ref="C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll" ^
 --ref="C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\Java.Interop.dll" ^
 --ref="C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v9.0\Mono.Android.dll" ^
 --ref="C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Core.dll" ^
 --ref="C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\System.dll" ^
 --ref="C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Runtime.dll" ^
 --ref="C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Xml.dll" ^
 --fixup=Transforms\Metadata.xml ^
 --enumfields=Transforms\EnumFields.xml ^
 --enummethods=Transforms\EnumMethods.xml ^
 --api-level=28 ^
 --type-map-report=obj\Debug\generated\type-mapping.txt ^
 --global ^
 --public

When I run this command line in the project folder, I get (as expected) the same errors as in Visual Studio 2019. Now when I'm changing the path to generator.exe to use the VS 2017 generator.exe (but not changing the references to MonoAndroid assemblies), I get no warnings.

How can I fix these warnings? Or is this a regression in the generator.exe tool? Thanks!

Activity

  1. jpobst commented on Dec 18, 2019

    @jpobst
    Contributor

    I'm not aware of anything that should have changed this in 16.4. Can you provide your api.xml so I can try to reproduce?

  2. MFinkBK commented on Dec 18, 2019

    @MFinkBK
    Author

    Here's the api.xml from the obj/Debug folder.
    api.zip

  3. jpobst commented on Dec 18, 2019

    @jpobst
    Contributor

    When you say Starting with VS 2019 16.4.0, what version were you on previously that works correctly? Are you jumping from VS2017 or were you on an earlier version of VS2019?

  4. jpobst commented on Dec 18, 2019

    @jpobst
    Contributor

    I think this is caused by this change: #450.

    We are attempting to resolve the type

    System.Collections.Generic.IList<Java.Util.Locale.LanguageRange>
    

    but the key in the symbol table is

    System.Collections.Generic.IList`1
    

    We need to either strip more arity or less.

    Is this just a warning in your project? Does it actually keep any bindings from being generated?

  5. MFinkBK commented on Dec 19, 2019

    @MFinkBK
    Author

    I was upgrading from VS 2019 16.3.10. It's just warning messages, but I try to be as warnings-free as possible. At the moment I have added a Jenkins console parse rule to not mark the messages as warnings.

  6. MFinkBK commented on Jan 7, 2020

    @MFinkBK
    Author

    I see the commits in the master and the d16-5 branches. Is the fix contained in VS 2019 version 16.5.x then?

  7. jpobst commented on Jan 7, 2020

    @jpobst
    Contributor

    Yes, it will be available beginning in 16.5 Preview 2.

  8. awattar commented on Jan 26, 2020

    @awattar

    What is the ETA of the 16.5 going stable?

    For me this is critical as it broke my binding project due to chain of reactions that ending with whole types being removed from the generated binding.

    BINDINGSGENERATOR : warning BG8800: Unknown parameter type System.Collections.Generic.ICollection<System.String> in method GetStringSet in managed type Android.Content.ISharedPreferences.
    BINDINGSGENERATOR : warning BG8503: Invalidating Android.Content.ISharedPreferences and all nested types because some of its methods were invalid.
    
  9. jpobst commented on Jan 26, 2020

    @jpobst
    Contributor

    I don't believe an RTM date has been announced for 16.5, however this fix is included in the 16.5 Preview 2 that came out this week. The preview installs side-by-side with your existing VS so you can use it without messing up your current VS.

    https://docs.microsoft.com/en-us/visualstudio/releases/2019/release-notes-preview#16.5.0-pre.2.0

  10. awattar commented on Jan 26, 2020

    @awattar

    Unfortunately, I'm working on Mac and side by side preview doesn't work from some time.

  11. added this to the milestone on Feb 3, 2020
  12. modified the milestones: , Published: 10.2 (d16-5) on Mar 1, 2021
  13. locked and limited conversation to collaborators on Apr 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions