Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Linker Issue

Hey there,

I'm just wondering if anyone can help me out here.
I am trying to use the linker to reduce the size of my apk.
I have gotten a few errors and resolved them by adding the assemblies to my linker.config file in my Android project.

I am getting the below error:
Mono.Linker.MarkException: Error processing method: 'System.Security.Claims.ClaimsPrincipal IdentityServer4.IdentityServerPrincipal::Create(System.String,System.String,System.String,System.Collections.Generic.IEnumerable`1<System.String>,System.DateTime,System.Security.Claims.Claim[])' in assembly: 'IdentityServer4.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.Int32 IdentityModel.EpochTimeExtensions::ToEpochTime(System.DateTime) 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 Xamarin.Android.Tasks.AndroidTask.Execute()

-I have added IdentityServer4 to my linker.config file but it hasn't resolved the issue.
-I have cleaned and rebuilt my solution approx 4 billion times as I've seen that has resolved similar issues for other people.
-All my nuget packages are up to date.
-If I set linker to None, it works but my apk is about 110MB.

Thanks in advance,
Shane

Tagged:

Best Answer

Answers

  • shaneconatyshaneconaty Member

    Sorry only getting to reply now.
    That worked for me thanks, thanks.
    I was following a blog post on progrunning[dot]net called 'Fixing Xamarin.Forms linker issues'
    (sorry the fourm won't let me post a link)

Sign In or Register to comment.