LeoChen98 / BiliAccount

基于.net standard的B站账号操作封装。|A .net standard library for bilibili account operations.(like login and sso)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

在CentOS8环境中LoginByQrCode获取二维码报错

CHKZL opened this issue · comments

commented

2.5.1.23版本
在CentOS8环境中,调用LoginByQrCode获取二维码时
依赖框架3.1运行时报错:
Unhandled exception. 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 LD_DEBUG environment variable: liblibgdiplus: cannot open shared object file: No such file or directory
at System.Drawing.SafeNativeMethods.Gdip.GdiplusStartup(IntPtr& token, StartupInput& input, StartupOutput& output)
at System.Drawing.SafeNativeMethods.Gdip..cctor()
--- End of inner exception stack trace ---
at System.Drawing.SafeNativeMethods.Gdip.GdipCreateBitmapFromScan0(Int32 width, Int32 height, Int32 stride, Int32 format, IntPtr scan0, IntPtr& bitmap)
at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format)
at QRCoder.QRCode.GetGraphic(Int32 pixelsPerModule, Color darkColor, Color lightColor, Bitmap icon, Int32 iconSizePercent, Int32 iconBorderWidth, Boolean drawQuietZones)
at BiliAccount.Core.ByQRCode.GetQrcode(Color Foreground, Color Background, Boolean IsBorderVisable)
at BiliAccount.Linq.ByQRCode.LoginByQrCode(Color Foreground, Color Background, Boolean IsBorderVisable)
at BiliAccount.Linq.ByQRCode.LoginByQrCode(String strForeground, String strBackground, Boolean IsBorderVisable)

CentOS8环境需要手动安装 libgdiplus

Mac m1 遇上这个问题,并且编译过程中还找不到libpng16,make check也跑不过,详情 libgdiplus issue Build for Apple Silicon。最后切换到了windows

建议使用2.5.5.27(或更新)版本下Linq.ByQRCode.LoginByQrCodeUrl方法,然后监听Linq.ByQRCode.QrCodeUrlRefreshLinq.ByQRCode.QrCodeStatus_Changed处理刷新和登录事件。