繁体   English   中英

System.Drawing单声道故障调试

[英]System.Drawing mono failure debugging

根据有关mono-test-install结果失败的答案 ,我将以下内容放在test.cs

using System;
using System.Drawing;

class X { 
    static void Main ()
    {
        Bitmap b = new Bitmap (100, 100);
    }
}

然后跑了

mcs -pkg:dotnet test.cs

输出:

test.cs(7,16):警告CS0219:变量“b”已分配,但其值从未使用编译成功 - 1个警告

然后运行生成的exe:

mono test.exe

输出:

Unhandled Exception:
System.TypeInitializationException: An exception was thrown by the type initializer for System.Drawing.GDIPlus ---> System.DllNotFoundException: /usr/local/lib/libgdiplus.so
  at (wrapper managed-to-native) System.Drawing.GDIPlus:GdiplusStartup (ulong&,System.Drawing.GdiplusStartupInput&,System.Drawing.GdiplusStartupOutput&)
  at System.Drawing.GDIPlus..cctor () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.Drawing.Bitmap..ctor (Int32 width, Int32 height, PixelFormat format) [0x00000] in <filename unknown>:0 
  at System.Drawing.Bitmap..ctor (Int32 width, Int32 height) [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.Drawing.Bitmap:.ctor (int,int)
  at X.Main () [0x00000] in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: An exception was thrown by the type initializer for System.Drawing.GDIPlus ---> System.DllNotFoundException: /usr/local/lib/libgdiplus.so
  at (wrapper managed-to-native) System.Drawing.GDIPlus:GdiplusStartup (ulong&,System.Drawing.GdiplusStartupInput&,System.Drawing.GdiplusStartupOutput&)
  at System.Drawing.GDIPlus..cctor () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.Drawing.Bitmap..ctor (Int32 width, Int32 height, PixelFormat format) [0x00000] in <filename unknown>:0 
  at System.Drawing.Bitmap..ctor (Int32 width, Int32 height) [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.Drawing.Bitmap:.ctor (int,int)
  at X.Main () [0x00000] in <filename unknown>:0 

忽略这个是安全的还是我应该调试NotFoundException: /usr/local/lib/libgdiplus.soNotFoundException: /usr/local/lib/libgdiplus.so next?

谢谢Jon,我刚刚找到那个页面,虽然我没有逐字逐句,但我把符号链接放在:

sudo ln -s /usr/lib/libgdiplus.so /usr/local/lib/libgdiplus.so

这解决了错误,现在mono-test-install返回:

你有一个工作System.Drawing设置

除语法问题外,还应该解决。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM