MetacoSA / NBitcoin

Comprehensive Bitcoin library for the .NET framework.
MIT License
1.88k stars 848 forks source link

NBitcoin 6.0.8 can't build for Android. Linker issue #1048

Closed ArtjomP closed 3 years ago

ArtjomP commented 3 years ago

Hello there! I updated NBitcoin 5.0.83 to 6.0.8 for Xarmarin.Forms project & it stopped building for Android with error: ##[error]C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets(643,5): Error XALNK7000: Mono.Linker.MarkException: Error processing method: 'NBitcoin.Script NBitcoin.Altcoins.BCash/BTrashPubKeyAddress::GeneratePaymentScript()' in assembly: 'NBitcoin.Altcoins.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve NBitcoin.Script NBitcoin.TxDestination::get_ScriptPubKey() at Mono.Linker.Steps.MarkStep.HandleUnresolvedMethod(MethodReference reference) at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference) at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction) at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body) at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method) at Mono.Linker.Steps.MarkStep.ProcessQueue() --- End of inner exception stack trace --- at Mono.Linker.Steps.MarkStep.ProcessQueue() at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue() at Mono.Linker.Steps.MarkStep.Process() 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) at Xamarin.Android.Tasks.LinkAssemblies.RunTask() at Microsoft.Android.Build.Tasks.AndroidTask.Execute() It would be great to get it fixed. Does anybody have ideas on how to fix it? Thank you in advance!

NicolasDorier commented 3 years ago

hi @ArtjomP . You need to rebuild NBitcoin.Altcoins.dll as well.

ArtjomP commented 3 years ago

Thank you @NicolasDorier . I don't use NBitcoin.Altcoins explicitly. NBitcoin uses from the Nuget NBitcoin.Altcoins I could update it myself and upload to a private feed but I would wait for the official version.

Have a good time!

NicolasDorier commented 3 years ago

@ArtjomP that's weird, NBitcoin.Altcoins is up to date on the nuget.

NicolasDorier commented 3 years ago

I think the problem is more related to some cache from xamarin or something like that.

ArtjomP commented 3 years ago

Thank you for your reply. It does not look like the cache problem because we use MS agents and they start building from the scratch. It was QBitninja that caused the issue. Have a great time!

NicolasDorier commented 3 years ago

@ArtjomP ah I was not expecting QBitNinja to still be used. I will try to publish a new version.

NicolasDorier commented 3 years ago

@ArtjomP I published version 1.0.4 of the QBitNinja.Client library built against latest version of NBitcoin.