根据这个关于失败结果的答案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.so
接下来调试该行吗?