mkaring / ConfuserEx

An open-source, free protector for .NET applications
https://mkaring.github.io/ConfuserEx/
MIT License
2.38k stars 370 forks source link

Xamarin Android Project failed in target "_LinkAssembliesShrink" #437

Closed mczhao1977 closed 2 years ago

mczhao1977 commented 3 years ago

Steps to Reproduce:

I add one target in my csproj file to call ConfuserEx CLI to obfuscate the code after assembly built. The ConfuserEx successfully processed the assembly but the subsequence target _LinkAssembliesShrink failed with following error: XALNK7000: Mono.Linker.MarkException: Error processing method: 'System.Void demo.Pages.TestingPage::_B7m7Lms8Dbak5MgE0S8fg8CIYJuA()' in assembly: 'demo.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.Void demo.Pages.TestingPage::skPreview_PaintSurface(System.Object,SkiaSharp.Views.Forms.SKPaintSurfaceEventArgs) 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()

It seems linking process can't find some obfuscated method. So what's the best point to insert the obfuscation target?

Thanks

mkaring commented 2 years ago

This is very difficult to say, based on the information provided. I'm guessing some protection is active that doesn't work well with the Android target. What are the obfuscation settings used in this case?

github-actions[bot] commented 2 years ago

This issue needs more information and has not had recent activity. Please provide the missing information or it will be closed in 7 days. Thanks!

github-actions[bot] commented 2 years ago

Closing this issue because it needs more information and has not had recent activity. Please re-open this issue if more details can be provided. Thanks!

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.