C#单{新的位图(QUOT;文件名");}只是挂在OSX [英] C# Mono {new Bitmap("fileName");} Just hangs on OSX

查看:128
本文介绍了C#单{新的位图(QUOT;文件名");}只是挂在OSX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当试图加载无论是.BMP,png格式或使用System.Drawing.Bitmap的单声道的版本对象只是挂在应用上OSX 10.7.3.JPG。我没有得到任何错误,应用程序只是贴在位图构造函数...

When trying to load either a ".bmp", ".png" or ".jpg" on OSX 10.7.3 using mono's version of the System.Drawing.Bitmap object the applications just hangs. I get no error, the app just is stuck on the Bitmaps constructor...

当我运行在同一个code(ARCH)Linux或Windows一切工作正常。

When I run the same code on (Arch)Linux or Windows everything works fine.

public static void Main (string[] args)
{
    using (var bitmap = new Bitmap("/....../image.bmp"))
    {

    }

    Console.WriteLine ("Hello World!");// Never gets here...
}

如果我暂停在调试模式下应用它打开反汇编窗口,并显示其停留在这一行:

If I pause the application in debug mode it opens the "disassembly" window and shows its stuck on this line:

call Status System.Drawing.GDIPlus:GdiplusStartup (UInt64, GdiplusStartupInput, GdiplusStartupOutput)

请注意:在调试模式下暂停申请了几次后,它神奇开始在写这个工作。我PROMIS我没有改变任何code。任何人都知道是什么导致System.Drawing.GDIPlus挂,所以我知道如何避免它?是否有一个单声道codeX设置文件或东西,可能有斌搞砸了?

NOTE: After pausing the application in debug mode a couple of times it "Magically" started to work while writing this. I promis I did not change any code. Anybody know what can cause "System.Drawing.GDIPlus" to hang so I know how to avoid it?? Is there a mono codex setting file or something that could have bin messed up?

推荐答案

问题就是性能。它无关,与你code;图像只是服用较长时间来加载。结果
Mono的实施 System.Drawing中只是一个C#包装,是有点不完整,不(或不正确)提供 System.Drawing中。因为它采用原生它可能会在Windows运行良好的Gdiplus.dll ,但可能无法在基于Unix的系统运作良好,因为它使用了开罗引擎。你可以找到更多信息这里

The problem is just performance. It has nothing to do with you code; the image is just taking a longer time to load.
Mono's implementation of System.Drawing is just a C# wrapper and is kinda incomplete and does not (or incorrectly) provide all features in System.Drawing. It may function well in windows because it uses the native GDIPlus.dll but in may not function well in unix-based systems because it uses the Cairo engine. You can find more information here.

这篇关于C#单{新的位图(QUOT;文件名");}只是挂在OSX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆