I am having an old library written in VB.net .net 3.5 using this library as dll or project reference on Xamarin.Android project works fine with linker to "none". Problem starts if I use a linker. When I set the linker as "SDK assemblies only", I am getting the following error message.
Error Java.Interop.Tools.Diagnostics.XamarinAndroidException: error XA2006: Could not resolve reference to 'System.Void Microsoft.VisualBasic.MyGroupCollectionAttribute::.ctor(System.String,System.String,System.String,System.String)' (defined in assembly 'VBLibraryProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null') with scope 'Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken='. When the scope is different from the defining assembly, it usually means that the type is forwarded. ---> Mono.Cecil.ResolutionException: Failed to resolve System.Void Microsoft.VisualBasic.MyGroupCollectionAttribute::.ctor(System.String,System.String,System.String,System.String) at Mono.Linker.Steps.MarkStep.HandleUnresolvedMethod(MethodReference reference) at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference) at Mono.Linker.Steps.MarkStep.MarkCustomAttribute(CustomAttribute ca)
at Mono.Linker.Steps.MarkStep.MarkCustomAttributes(ICustomAttributeProvider provider) at Mono.Linker.Steps.MarkStep.MarkEntireType(TypeDefinition type) at Mono.Linker.Steps.MarkStep.MarkEntireType(TypeDefinition type) at Mono.Linker.Steps.MarkStep.MarkEntireAssembly(AssemblyDefinition assembly) at Mono.Linker.Steps.MarkStep.InitializeAssembly(AssemblyDefinition assembly) at Mono.Linker.Steps.MarkStep.Initialize() at Mono.Linker.Steps.MarkStep.Process(LinkContext context) at MonoDroid.Tuner.MonoDroidMarkStep.Process(LinkContext context) at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
at Mono.Linker.Pipeline.Process(LinkContext context) at MonoDroid.Tuner.Linker.Process(LinkerOptions options, ILogger logger, LinkContext& context) at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
I have added AndroidLinkSkip for those libraries like below
<AndroidLinkSkip>Microsoft.VisualBasic;Microsoft.VisualBasic.Core;VBLibraryProject</AndroidLinkSkip>
Despite that it is still failing with the same error? Project is using the latest XF 4.8 version with Android.Support libraries and target version android 9.0 minimum version 8.0
EDIT:
I have tried with a linker.xml from type of LinkDescription
as below but it didnt help.
<linker>
<assembly fullname="Microsoft.VisualBasic">
<namespace fullname="Microsoft.VisualBasic" />
</assembly>
<assembly fullname="Microsoft.VisualBasic.Core">
<namespace fullname="Microsoft.VisualBasic" />
</assembly>
<assembly fullname="VBLibraryProject">
If you need some definitions from the SDK or product assemblies then using an XML file might be your best solution (versus adding code that will ensure the linker won't eliminate what you need).
You could refer to Custom Linker Configuration