首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >System.Drawing单故障调试

System.Drawing单故障调试
EN

Stack Overflow用户
提问于 2013-11-07 20:11:48
回答 1查看 2.8K关注 0票数 1

根据this answer关于失败的mono-test-install结果,我在test.cs中放置了以下内容

代码语言:javascript
复制
using System;
using System.Drawing;

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

然后跑

代码语言:javascript
复制
mcs -pkg:dotnet test.cs

产出:

test.cs(7,16):警告CS0219:变量‘b’被赋值,但它的值从未被使用过编译成功-1警告

并以以下方式运行生成的exe:

代码语言:javascript
复制
mono test.exe

产出:

代码语言:javascript
复制
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

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-11-07 20:20:32

谢谢乔恩,我刚找到那一页,虽然我没有逐字看,但我在里面放了一个符号链接:

代码语言:javascript
复制
sudo ln -s /usr/lib/libgdiplus.so /usr/local/lib/libgdiplus.so

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

您有一个工作的System.Drawing设置

除了语法问题外,还需要解决。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19845720

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档