无法在带有web sockets的Signal R web应用程序中加载libgdiplus (Mac OS)



我从GitHub下载了这个存储库,并尝试在我的MacOS笔记本电脑上运行它。它使用R信号和web套接字。
它构建,它启动,它工作

但是当我尝试打开web套接字时,我得到一个错误:

Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1]
An unhandled exception has occurred while executing the request.
System.TypeInitializationException: The type initializer for 'Gdip' threw an exception.
---> System.DllNotFoundException: Unable to load shared library 'libgdiplus' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable: dlopen(liblibgdiplus, 0x0001): tried: 'liblibgdiplus' (no such file), '/System/Volumes/Preboot/Cryptexes/OSliblibgdiplus' (no such file), '/usr/lib/liblibgdiplus' (no such file, not in dyld cache), 'liblibgdiplus' (no such file), '/usr/local/lib/liblibgdiplus' (no such file), '/usr/lib/liblibgdiplus' (no such file, not in dyld cache)
at System.Drawing.SafeNativeMethods.Gdip.GdiplusStartup(IntPtr& token, StartupInput& input, StartupOutput& output)
at System.Drawing.SafeNativeMethods.Gdip..cctor()
--- End of inner exception stack trace ---

我做了brew install mono-libgdiplus,但没有帮助。

我是c#和微软框架的新手,所以我还能做什么?(MacOS Ventura, Apple M1)

解决:System.Drawing在我的MacOS上不支持,所以这个库使用的代码不应该被执行。

虽然你玩的这个项目是为跨平台设计的,但不幸的是,它是在。net 6引入一个重要的突破性变化之前开发的,即System.Drawing相关的API只支持Windows。

就像你发现的那样,注释掉与System.Drawing相关的行是有效的。但是如果你想要类似的功能,你将不得不用另一个绘图库重写这部分。如果使用搜索引擎,有很多这样的选择。

最新更新