0

I've been using SkiaSharp (a C# wrapper around Google's Skia vector graphics library) with success until today. I am using Visual Studio 2015 Community. I have a Winform that contains a custom control that uses SkiaSharp to paint itself. Everything was going great until I initialized a git repo for my project.

Now I can build and run my project just fine in both Debug and Release modes, but I can no longer use the designer on the form that contains the Skia control. I see the following exception:

System.DllNotFoundException: Unable to load DLL 'libskia_windows.dll': The specified module could not be found.
  at SkiaSharp.SkiaApi.sk_surface_new_raster_direct(...)
  at SkiaSharp.SKSurface.Create(...)
  ...
  at SkiaView.OnPaint(...)
  at System.Windows.Forms.Control.PaintWithErrorHandling(...)
  ...

When I delete the bin and obj directories and build my solution, 'libskia_windows.dll' is properly copied to those directories. And as I said, it runs fine. So why can't the designer find it?

tdenniston
  • 3,389
  • 2
  • 21
  • 29
  • 2
    Pretty unclear how it could ever have worked. You need to use `if (!DesignMode)` in your Paint event handler so you don't try to run code from a native DLL that the operating system cannot find at design-time. It doesn't know to look in your bin\Debug folder. – Hans Passant Apr 05 '16 at 18:27
  • @HansPassant Thank you, that worked. If you submit an answer I will accept it. – tdenniston Apr 05 '16 at 18:49

0 Answers0