【发布时间】:2018-09-29 05:53:06
【问题描述】:
我使用的是 ubuntu 13.04,我在 Ubuntu-13.04 上成功安装了 mono-3.1.2。 现在我正在尝试从 Windows Visual Studio 运行 C# .exe。
$ mono WindowsFormsApplication1.exe
我得到以下信息:-
Unhandled Exception:
System.TypeInitializationException: An exception was thrown by the type initializer for System.Windows.Forms.XplatUI ---> 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.Graphics.FromHdcInternal (IntPtr hdc) [0x00000] in <filename unknown>:0
at System.Windows.Forms.XplatUIX11.SetDisplay (IntPtr display_handle) [0x00000] in <filename unknown>:0
at System.Windows.Forms.XplatUIX11..ctor () [0x00000] in <filename unknown>:0
at System.Windows.Forms.XplatUIX11.GetInstance () [0x00000] in <filename unknown>:0
at System.Windows.Forms.XplatUI..cctor () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Windows.Forms.Application.EnableVisualStyles () [0x00000] in <filename unknown>:0
at WindowsFormsApplication1.Program.Main () [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: An exception was thrown by the type initializer for System.Windows.Forms.XplatUI ---> 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.Graphics.FromHdcInternal (IntPtr hdc) [0x00000] in <filename unknown>:0
at System.Windows.Forms.XplatUIX11.SetDisplay (IntPtr display_handle) [0x00000] in <filename unknown>:0
at System.Windows.Forms.XplatUIX11..ctor () [0x00000] in <filename unknown>:0
at System.Windows.Forms.XplatUIX11.GetInstance () [0x00000] in <filename unknown>:0
at System.Windows.Forms.XplatUI..cctor () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Windows.Forms.Application.EnableVisualStyles () [0x00000] in <filename unknown>:0
at WindowsFormsApplication1.Program.Main () [0x00000] in <filename unknown>:0
如何删除此异常,请帮助我。 提前致谢。
【问题讨论】:
-
我找到了一个解决方案,但我不确定这是一个好习惯。我运行了以下命令 $ find /usr -name libgdiplus.so 但我没有找到任何文件。所以我安装了libgdiplus $ sudo apt-get install libgdiplus 之后再次$ find /usr -name libgdiplus.so /usr/lib/libgdiplus.so 然后我简单地将libgdiplus.so复制到/usr/local/lib中。 $ mono WindowsFormsApplication1.exe 我得到了预期的输出。是很好的解决方案吗?或者如果有任何其他建议,请分享。
-
您将源中的单声道与软件包中的单声道混合在一起,它会咬你一口。请阅读mono-project.com/Parallel_Mono_Environments
标签: mono