xamarin Mono.Linker.MarkException:错误处理方法:'系统.Byte[]

swvgeqrz  于 2022-12-07  发布在  其他
关注(0)|答案(1)|浏览(140)

我得到这个错误,当我编译项目不知道什么是指..我试图转换一个图像到一个字节数组,所以我可以保存到数据库

i've updated the versions and nothing happens

Error Mono.Linker.MarkException: Error processing method: 'System.Byte[] HeavenTaste.NuevaOrden::converterDemo(Xamarin.Forms.Image)' in assembly: 'HeavenTaste.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.Void System.Drawing.ImageConverter::.ctor()
   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/runner/work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:line 17 HeavenTaste.Android C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\Android\Xamarin.Android.Legacy.targets  648
6ljaweal

6ljaweal1#

private async void btnGuardar(object sender, EventArgs e)
        {
            await DisplayAlert("",converterDemo(Vistaprevia).ToString(),"OK");
        }

 public byte[] converterDemo(Xamarin.Forms.Image x)
        {
            ImageConverter _imageConverter = new ImageConverter();
            byte[] xByte = (byte[])_imageConverter.ConvertTo(x, typeof(byte[]));
            
            return xByte;
        }

相关问题