0

I am trying to use the Chromium Embedded Framework.framework in my Mac app. In my sample .net code, this framework is referenced as libcef.dll. When I call a method on the framework, I get a System.DllNotFound exception. I have looked at DLL maps to map the CEF framework on the Mac to the expected DLL name of libcef.dll and I have the following map but this did not resolve the issue.

 <configuration>
  <dllmap dll="libcef.dll" target=" /Library/Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework"/>
</configuration>

I have also added the framework to my project within Visual Studio 2017 for Mac as a native reference but nor did this resolve the issue.

Does anyone know how I might be able to get around this DllNotFound exception?

Here is the stack track that I get when the DLLNotFound Exception is thrown:

System.DllNotFoundException: libcef
at at (wrapper managed-to-native) Xilium.CefGlue.Interop.libcef:api_hash (int)
at Xilium.CefGlue.CefRuntime.CheckVersionByApiHash () [0x00002] in /Users/jlaase/Documents/dev/xilium.cefglue/CefGlue/CefRuntime.cs:106
at Xilium.CefGlue.CefRuntime.CheckVersion () [0x00002] in /Users/jlaase/Documents/dev/xilium.cefglue/CefGlue/CefRuntime.cs:92
at Xilium.CefGlue.CefRuntime.Load () [0x0000c] in /Users/jlaase/Documents/dev/xilium.cefglue/CefGlue/CefRuntime.cs:81
at System.Threading.Tasks.Task.InnerInvoke () [0x0000f] in /Users/builder/data/lanes/4992/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2879
at System.Threading.Tasks.Task.Execute () [0x00010] in /Users/builder/data/lanes/4992/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2502
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/4992/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Users/builder/data/lanes/4992/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Users/builder/data/lanes/4992/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Users/builder/data/lanes/4992/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in /Users/builder/data/lanes/4992/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:113
at Demo.CefGlue.AppDelegate+c__async0.MoveNext () [0x00099] in <6839508fd4284d13b86c5e47bd563ec6>:0
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/4992/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.b__6_0 (System.Object state) [0x00000] in /Users/builder/data/lanes/4992/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1018
at MonoMac.AppKit.AppKitSynchronizationContext+c__AnonStorey0.<>m__0 () [0x00000] in <69849e6b886848f68ef0f56b62fe76aa>:0
at MonoMac.Foundation.NSAsyncActionDispatcher.Apply () [0x00002] in <69849e6b886848f68ef0f56b62fe76aa>:0
at at (wrapper managed-to-native) MonoMac.AppKit.NSApplication:NSApplicationMain (int,string[])
at MonoMac.AppKit.NSApplication.Main (System.String[] args) [0x0003d] in <69849e6b886848f68ef0f56b62fe76aa>:0
at Demo.CefGlue.MainClass.Main (System.String[] args) [0x00006] in <6839508fd4284d13b86c5e47bd563ec6>:0

Thanks,

Josh

Josh Laase
  • 326
  • 1
  • 13
  • On macOS, CEF uses `libcef.dylib`, the macOS app bundle layout requirement is described in the CEF docs. – SushiHangover Nov 28 '17 at 18:23
  • Where in the CEF Docs is this explained. When I looked at the documentation for Mac application layout, it calls out the framework with this structure: cefclient.app/ Contents/ Frameworks/ Chromium Embedded Framework.framework/ Chromium Embedded Framework <= main application library – Josh Laase Nov 28 '17 at 18:34
  • It turns out that dll map is working for me. What I did not know what that the when .net went to load the DLL, it was adding a lib to the start of all libraries it was trying to load. Once I renamed the framework to start with lib, it loaded without issue. – Josh Laase Jun 09 '18 at 18:41

0 Answers0