The type initializer for 'SkiaSharp.SKImageInfo' threw an exception.

See original GitHub issue

If i build this for linux, i get the error: The type initializer for 'SkiaSharp.SKImageInfo' threw an exception. Exception:

 ---> System.DllNotFoundException: Unable to load DLL 'libSkiaSharp' or one of its dependencies: The specified module could not be found. (0x8007007E)
   at SkiaSharp.SkiaApi.sk_colortype_get_default_8888()
   at SkiaSharp.SKImageInfo..cctor()
   --- End of inner exception stack trace ---
   at SkiaSharp.SKImageInfo..ctor(Int32 width, Int32 height)
   at AT.QRCoder.DiscordBot.Commands.QrCoder.GenerateQr(String content, String darkColor, String lightColor, String iconUrl) in C:\Users\Name\Desktop\ProjName\src\Proj.ProjName\Commands\File.cs:line 30```

at this line:
 ` var info = new SKImageInfo(660, 660);`

Do you know what causes that and how to fix that? 

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:21 (14 by maintainers)

github_iconTop GitHub Comments

2reactions
Alex-451commented, Nov 25, 2020

I still get the same error using the following package references:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Discord.Net" Version="2.2.0" />
    <PackageReference Include="Discord.Net.Core" Version="2.2.0" />
    <PackageReference Include="SkiaSharp" Version="2.80.2" />
    <PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="2.80.2" />
    <PackageReference Include="SkiaSharp.QrCode" Version="0.4.1" />
  </ItemGroup>

</Project>
2reactions
Alex-451commented, Nov 25, 2020

Thanks for the reply, these are my package references:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Discord.Net" Version="2.2.0" />
    <PackageReference Include="Discord.Net.Core" Version="2.2.0" />
    <PackageReference Include="SkiaSharp" Version="2.80.2" />
    <PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="2.80.2" />
    <PackageReference Include="SkiaSharp.QrCode" Version="0.4.0" />
  </ItemGroup>

</Project>```

Unfourtunately it doesnt work. 
Read more comments on GitHub >

github_iconTop Results From Across the Web

Type initializer for 'SkiaSharp.SKImageInfo' threw an ...
Type initializer for 'SkiaSharp.SKImageInfo ' threw an exception Avalonia ... This is how I setuped the gui_av_c directory. ~/C#$ mkdir gui_av_c ~/ ...
Read more >
The type initializer for 'SkiaSharp.SKObject' threw an ...
When I try to process a document with an image included in it, this error is being thrown. System.TypeInitializationException: 'The type ...
Read more >
System.DllNotFoundException - Microsoft Q&A
The type initializer for 'SkiaSharp.SKImageInfo ' threw an exception. Unable to load shared library 'libSkiaSharp' or one of its dependencies ...
Read more >
C# Application with SkiaSharp on Ubuntu 20.04 is excepting
NET 6 installed, it gives this: Unhandled exception. System.TypeInitializationException: The type initializer for 'SkiaSharp.SKImageInfo' threw ...
Read more >
Unable to load shared library 'libSkiaSharp' or one of its ...
TypeInitializationException: The type initializer for 'SkiaSharp.SKImageInfo' threw an exception. —> System.DllNotFoundException: Unable to load shared ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found