[英]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.so
行NotFoundException: /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.