oxyplot / oxyplot-xamarin

OxyPlot for Xamarin.Mac and Xamarin.Forms
MIT License
64 stars 59 forks source link

Getting this issue while creating a release build in xamarin application, Mono.Linker.MarkException: Error processing method: 'System.Void OxyPlot.Xamarin.Android.PlotView::OnDraw(Android.Graphics.Canvas)' in assembly: 'OxyPlot.Xamarin.Android.dll' #121

Open SandeepChorge opened 2 years ago

SandeepChorge commented 2 years ago

Hii, I am using Oxyplot.core 1.0.0 image

and currently facing issue while creating a release build of the application, getting following error

Severity Code Description Project File Line Suppression State Error Mono.Linker.MarkException: Error processing method: 'System.Void OxyPlot.Xamarin.Android.PlotView::OnDraw(Android.Graphics.Canvas)' in assembly: 'OxyPlot.Xamarin.Android.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.Void OxyPlot.IPlotModel::Render(OxyPlot.IRenderContext,System.Double,System.Double) 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() in /Users/builder/azdo/_work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:line 17 SalesAssist.Android

is there any leads how to solve this issue, I also tried upgrading the nuget version to 2.1.0 still facing same issue

VisualMelon commented 2 years ago

The method doesn't exist in 2.1, and there is no OxyPlot.Xamarin targeting 2.1, so that won't be any help I'm afraid.

I don't know much about Xamarin, but some mindless googling suggests this may just be a tooling issue that may be resolved by cleaning the solution fully. Are you able to try building the project on a different machine?

SandeepChorge commented 2 years ago

I tried cleaning and building the project it works just fine but at the time of Release APK creation it gives this error, and somehow my colleague does not get this issue on his System, I'll recheck again if there is any tooling issue

janusw commented 1 year ago

The method doesn't exist in 2.1, and there is no OxyPlot.Xamarin targeting 2.1, so that won't be any help I'm afraid.

In fact OxyPlot.Xamarin.Forms version 2.1.0 was released yesterday, so you could check if upgrading helps.

janusw commented 1 year ago

Error Mono.Linker.MarkException: Error processing method: 'System.Void OxyPlot.Xamarin.Android.PlotView::OnDraw(Android.Graphics.Canvas)' in assembly: 'OxyPlot.Xamarin.Android.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.Void OxyPlot.IPlotModel::Render(OxyPlot.IRenderContext,System.Double,System.Double)

This really looks a lot like 2.0.0 -> 2.1.0 incompatibility: In the course of updating OxyPlot.Xamarin.Forms to be compatible with OxyPlot.Core 2.1.0, I had to update PlotView::OnDraw to call the new Render method, which takes any OxyRect as argument instead of two doubles, see #142 and in particular ad250aad499d4cb2bfec07a9b7c52c9aaf50b282.

I strongly suspect that this issue will be fixed by updating to OxyPlot.Xamarin.Forms 2.1.0. @SandeepChorge, could you please confirm that this is the case?