3
votes

When I compile my Xamarin App in Debug mode, everything is fine. But when I compile in Release mode, I get the following error:

The "LinkAssemblies" task failed unexpectedly.
Mono.Linker.MarkException: Error processing method: 'System.Void Xamarin.Forms.Pages.BaseDataSource/<Initialize>d__22::MoveNext()' in assembly: 'Xamarin.Forms.Pages.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.Void Xamarin.Forms.Log::Warning(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.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 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.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()

I created another App, default "Welcome to Xamarin Forms". That worked fine. Added The pre-release themes and got the above error on Release build.

Has anyone built a Release App using the pre-release Light/Dark themes and knows how I can get it to build?

1

1 Answers

2
votes

Manged to fix it. Changed Linking to 'None' in Android Options under the Android project Properties... and... commenting out this code from MainActivity.cs. When I first looked at using the pre-release themes it said this code below was required. Seems for later versions of the themes, it is not required.

// Added for themes (does not seem to be required anymore)? 
//var x = typeof(Xamarin.Forms.Themes.DarkThemeResources); 
//x = typeof(Xamarin.Forms.Themes.LightThemeResources); 
//var x = typeof(Xamarin.Forms.Themes.Android.UnderlineEffect);