jonathanpeppers / Xamarin.Forms.Mocks

Library for running Xamarin.Forms inside of unit tests
MIT License
194 stars 26 forks source link

unable to load skiasharp assemblies #64

Open mced76 opened 4 years ago

mced76 commented 4 years ago

Hello,

In my Xamarin project, I have microcharts component which reference skiasharp assembly.

When I launch the unit test, App.init crash in the form creator "Could not load file or assembly 'SkiaSharp.Views.Forms, Version=2.80.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.\n" The skiasharp is here but I think that no plateform is defined in unit test and all the skiasharp component crash.

Have-you any idea to resolve it ?

(Xamarin.forms 4.8, VS 2019 - Mac, NUnit)

Thx

jonathanpeppers commented 4 years ago

Can you share the code for the test that's failing?

Or one better, can you add a new SkiaSharpTests that shows the problem in the project here:

https://github.com/jonathanpeppers/Xamarin.Forms.Mocks/tree/master/Xamarin.Forms.Mocks.Tests

Thanks!

mced76 commented 3 years ago

Sorry, I was very busy last week. I have added the Skiasharp Test in the project.

Thanks!

jonathanpeppers commented 3 years ago

If you go here and download the .nupkg file:

https://www.nuget.org/packages/SkiaSharp.Views.Forms/2.80.2

There is no SkiaSharp.Views.Forms.dll that would work in a unit test project:

image

We would need a net462 assembly or something for this to work in unit tests... This folder is empty.

As far as SkiaSharp.Views.Forms is concerned, it doesn't actually work on a platform that it doesn't have an assembly for.

JanettHolst290490 commented 3 years ago

Is there a workaround ? I just need the CodeBehind to work, not the actual Xaml elements.

jonathanpeppers commented 3 years ago

If the error is: "Could not load file or assembly 'SkiaSharp.Views.Forms, Version=2.80.0.0, Culture=neutral, PublicKeyToken=null'.

You could try unzipping the .nupkg and referencing the netstandard2.0 assembly directly. If anything calls into it, you'll hit a NotImplementedException, though.

So I'm not sure how useful this workaround would actually be.