Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Native library missing on Xamarin.Mac Full #913

Closed
Odirb opened this issue Jul 17, 2019 · 5 comments · Fixed by #919
Closed

[BUG] Native library missing on Xamarin.Mac Full #913

Odirb opened this issue Jul 17, 2019 · 5 comments · Fixed by #919
Milestone

Comments

@Odirb
Copy link

Odirb commented Jul 17, 2019

Description

  • Using Visual Studio for Mac (8.1.5 build 9), create a Mac / Cocoa App
  • In Options / Build / General, change "Xamarin.Mac Modern" to "Xamarin.Mac Full"
  • Add SkiaSharp nuget to project, and create a new SKBitmap

Application crash on SKBitmap creation with a DllNotFoundException in inner exception :

System.TypeInitializationException: The type initializer for 'SkiaSharp.SKImageInfo' threw an exception. ---> System.DllNotFoundException: libSkiaSharp
at at (wrapper managed-to-native) SkiaSharp.SkiaApi.sk_colortype_get_default_8888()
at SkiaSharp.SKImageInfo..cctor () [0x00000] in :0
--- End of inner exception stack trace ---
at at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_generic_class_init(intptr)
at SkiaSharp.SKBitmap..ctor (System.Int32 width, System.Int32 height, System.Boolean isOpaque) [0x00000] in :0
at TestSkia.MainClass.Main (System.String[] args) [0x00001] in /Users/christophe/Projects/TestSkia/TestSkia/Main.cs:10

Code
`namespace TestSkia
{
static class MainClass
{
static void Main(string[] args)
{
new SKBitmap(10, 10);

        NSApplication.Init();
        NSApplication.Main(args);
    }
}

}
`

Expected Behavior

Output directory should contains libSkiaSharp.dylib (native Skia library for OSX)

Actual Behavior

Output directory contains x86/libSkiaSharp.dll and x64/libSkiaSharp.dll, which are native library for Windows and not OSX

Basic Information

  • Version with issue: 1.68.0
  • IDE: Visual Studio for Mac (8.1.5 build 9)
  • Platform Target Frameworks:
    • macOS: mojave 10.14.5
@mattleibow
Copy link
Contributor

I believe this is a duplicate of #736

@mattleibow
Copy link
Contributor

You can add <MigrateToNewXMIdentifier>true</MigrateToNewXMIdentifier> in your project.

@Odirb
Copy link
Author

Odirb commented Jul 22, 2019

Thanks for you response Matthew,
But when I add MigrateToNewXMIdentifier to my project it cannot be loaded by Visual Studio (I'm using the latest VS for Mac 2019 - version 8.1.5 build 9).

I have extracted the exception from ~/Library/Logs/VisualStudio/8.0/Ide.2019-07-22__09-01-53.log file :

> 2019-07-22 09:55:10.238 VisualStudio[1779:67299] View <NSStackView: 0x7fa2b2206f50> has 1 views pointing at it that can't be found.
ERROR [2019-07-22 09:55:10Z]: Error while trying to load the project /Users/christophe/Projects/TestSkia/FullMicMac/FullMicMac.csproj
System.ArgumentException: Project does not support framework 'Xamarin.Mac.NET,Version=v4.7.2'
  at MonoDevelop.Projects.DotNetProject.set_TargetFramework (MonoDevelop.Core.Assemblies.TargetFramework value) [0x0008a] in /Users/vsts/agent/2.153.2/work/1/s/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProject.cs:419 
  at MonoDevelop.Projects.DotNetProject.OnReadProjectHeader (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.MSBuild.MSBuildProject msproject) [0x00106] in /Users/vsts/agent/2.153.2/work/1/s/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProject.cs:1972 
  at MonoDevelop.Projects.Project+DefaultMSBuildProjectExtension.OnReadProjectHeader (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.MSBuild.MSBuildProject msproject) [0x00000] in /Users/vsts/agent/2.153.2/work/1/s/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs:4836 
  at MonoDevelop.Projects.ProjectExtension.OnReadProjectHeader (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.MSBuild.MSBuildProject msproject) [0x00000] in /Users/vsts/agent/2.153.2/work/1/s/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:141 
  at MonoDevelop.Projects.ProjectExtension.OnReadProjectHeader (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.MSBuild.MSBuildProject msproject) [0x00000] in /Users/vsts/agent/2.153.2/work/1/s/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:141 
  at MonoDevelop.Projects.ProjectExtension.OnReadProjectHeader (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.MSBuild.MSBuildProject msproject) [0x00000] in /Users/vsts/agent/2.153.2/work/1/s/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:141 
  at MonoDevelop.Projects.ProjectExtension.OnReadProjectHeader (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.MSBuild.MSBuildProject msproject) [0x00000] in /Users/vsts/agent/2.153.2/work/1/s/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:141 
  at MonoDevelop.Projects.ProjectExtension.OnReadProjectHeader (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.MSBuild.MSBuildProject msproject) [0x00000] in /Users/vsts/agent/2.153.2/work/1/s/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:141 
  at MonoDevelop.Projects.ProjectExtension.OnReadProjectHeader (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.MSBuild.MSBuildProject msproject) [0x00000] in /Users/vsts/agent/2.153.2/work/1/s/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:141 
  at MonoDevelop.Projects.ProjectExtension.OnReadProjectHeader (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.MSBuild.MSBuildProject msproject) [0x00000] in /Users/vsts/agent/2.153.2/work/1/s/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:141 
  at MonoDevelop.Projects.ProjectExtension.OnReadProjectHeader (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.MSBuild.MSBuildProject msproject) [0x00000] in /Users/vsts/agent/2.153.2/work/1/s/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:141 
  at MonoDevelop.Projects.ProjectExtension.OnReadProjectHeader (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.MSBuild.MSBuildProject msproject) [0x00000] in /Users/vsts/agent/2.153.2/work/1/s/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:141 
  at MonoDevelop.Projects.ProjectExtension.OnReadProjectHeader (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.MSBuild.MSBuildProject msproject) [0x00000] in /Users/vsts/agent/2.153.2/work/1/s/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:141 
  at MonoDevelop.MonoMac.XamMac2ProjectFlavor.OnReadProjectHeader (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.MSBuild.MSBuildProject msproject) [0x00000] in /Users/vsts/agent/2.150.3/work/1/s/MonoDevelop.MonoMac/MonoDevelop.MonoMac/Project/XamMac2Project.cs:309 
  at MonoDevelop.Projects.ProjectExtension.OnReadProjectHeader (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.MSBuild.MSBuildProject msproject) [0x00000] in /Users/vsts/agent/2.153.2/work/1/s/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:141 
  at MonoDevelop.Projects.ProjectExtension.OnReadProjectHeader (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.MSBuild.MSBuildProject msproject) [0x00000] in /Users/vsts/agent/2.153.2/work/1/s/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:141 
  at MonoDevelop.Projects.ProjectExtension.OnReadProjectHeader (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.MSBuild.MSBuildProject msproject) [0x00000] in /Users/vsts/agent/2.153.2/work/1/s/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:141 
  at MonoDevelop.Projects.ProjectExtension.OnReadProjectHeader (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.MSBuild.MSBuildProject msproject) [0x00000] in /Users/vsts/agent/2.153.2/work/1/s/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:141 
  at MonoDevelop.Projects.ProjectExtension.OnReadProjectHeader (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.MSBuild.MSBuildProject msproject) [0x00000] in /Users/vsts/agent/2.153.2/work/1/s/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectExtension.cs:141 
  at MonoDevelop.Projects.Project.ReadProject (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.MSBuild.MSBuildProject msproject) [0x0004d] in /Users/vsts/agent/2.153.2/work/1/s/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs:2593 
  at MonoDevelop.Projects.Project.LoadAsync (MonoDevelop.Core.ProgressMonitor monitor) [0x000ed] in /Users/vsts/agent/2.153.2/work/1/s/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs:437 
  at MonoDevelop.Projects.Project+<>c__DisplayClass68_0.<OnLoad>b__0 () [0x00028] in /Users/vsts/agent/2.153.2/work/1/s/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs:418 
  at MonoDevelop.Projects.MSBuild.MSBuildProjectService.LoadItem (MonoDevelop.Core.ProgressMonitor monitor, System.String fileName, MonoDevelop.Projects.MSBuild.MSBuildFileFormat expectedFormat, System.String typeGuid, System.String itemGuid, MonoDevelop.Projects.SolutionLoadContext ctx) [0x001f0] in /Users/vsts/agent/2.153.2/work/1/s/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildProjectService.cs:405 
  at MonoDevelop.Projects.ProjectService+<>c__DisplayClass25_0.<ReadSolutionItem>b__0 () [0x00101] in /Users/vsts/agent/2.153.2/work/1/s/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectService.cs:126 
  at MonoDevelop.Core.Runtime+<>c__44`1[T].<RunInMainThread>b__44_0 (System.Object state) [0x00046] in /Users/vsts/agent/2.153.2/work/1/s/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Core/Runtime.cs:389 

@Odirb
Copy link
Author

Odirb commented Jul 24, 2019

Since VS for Mac is not ready to target Xamarin.Mac.NET yet, I will use this ugly workaround for now: add the libSkiaSharp.dylib in my main project as "Content". The library will be copy in bundle after compilation in the correct folder to be loaded by SkiaSharp.dll

@mattleibow
Copy link
Contributor

mattleibow commented Jul 26, 2019

It is a tad bit disappointing. But the workaround to add the .dylib should do it for the time being. I'll have a look at the targets file - I may be able to tweak a few lines to copy this in if it detects the full framework.

Just a link to the info about the support: NuGet/NuGet.Client#2572 (comment)

@mattleibow mattleibow added this to the v1.68.1 milestone Nov 21, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Aug 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants