Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# mono mac osx csharp win形成gdi字体例外,但不使用任何MS字体_C#_Macos_Mono_Winforms Interop - Fatal编程技术网

C# mono mac osx csharp win形成gdi字体例外,但不使用任何MS字体

C# mono mac osx csharp win形成gdi字体例外,但不使用任何MS字体,c#,macos,mono,winforms-interop,C#,Macos,Mono,Winforms Interop,我们正试图在MacOSX上运行一个我们重写的C#Win表单应用程序。在以前的版本中,与win form相关的一切都正常工作,但现在我们在Mac上实现了这一点: Unhandled Exception: System.TypeInitializationException: An exception was thrown by the type initializer for System.Windows.Forms.WindowsFormsSynchronizationContext ---&g

我们正试图在MacOSX上运行一个我们重写的C#Win表单应用程序。在以前的版本中,与win form相关的一切都正常工作,但现在我们在Mac上实现了这一点:

Unhandled Exception:
System.TypeInitializationException: An exception was thrown by the type initializer for System.Windows.Forms.WindowsFormsSynchronizationContext ---> System.TypeInitializationException: An exception was thrown by the type initializer for System.Windows.Forms.ThemeEngine ---> System.ArgumentException: The requested FontFamily could not be found [GDI+ status: FontFamilyNotFound]
  at System.Drawing.GDIPlus.CheckStatus (Status status) [0x00000] in <filename unknown>:0 
  at System.Drawing.FontFamily..ctor (GenericFontFamilies genericFamily) [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.Drawing.FontFamily:.ctor (System.Drawing.Text.GenericFontFamilies)
  at System.Drawing.FontFamily.get_GenericSansSerif () [0x00000] in <filename unknown>:0 
  at System.Drawing.Font.CreateFont (System.String familyName, Single emSize, FontStyle style, GraphicsUnit unit, Byte charSet, Boolean isVertical) [0x00000] in <filename unknown>:0 
  at System.Drawing.Font..ctor (System.String familyName, Single emSize, FontStyle style, GraphicsUnit unit, Byte gdiCharSet, Boolean gdiVerticalFont) [0x00000] in <filename unknown>:0 
  at System.Drawing.Font..ctor (System.String familyName, Single emSize, System.String systemName) [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.Drawing.Font:.ctor (string,single,string)
  at System.Drawing.SystemFonts.get_DefaultFont () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Theme..ctor () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.ThemeWin32Classic..ctor () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.ThemeVisualStyles..ctor () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.ThemeEngine..cctor () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.Windows.Forms.SystemInformation.get_MenuAccessKeysUnderlined () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Control..ctor () [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control:.ctor ()
  at System.Windows.Forms.WindowsFormsSynchronizationContext..cctor () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.Windows.Forms.Control..ctor () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.ScrollableControl..ctor () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.ContainerControl..ctor () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Form..ctor () [0x00000] in <filename unknown>:0 
  at NewWorldStudio.StartupForm..ctor () [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) NewWorldStudio.StartupForm:.ctor ()
  at NewWorldStudio.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.WindowsFormsSynchronizationContext ---> System.TypeInitializationException: An exception was thrown by the type initializer for System.Windows.Forms.ThemeEngine ---> System.ArgumentException: The requested FontFamily could not be found [GDI+ status: FontFamilyNotFound]
  at System.Drawing.GDIPlus.CheckStatus (Status status) [0x00000] in <filename unknown>:0 
  at System.Drawing.FontFamily..ctor (GenericFontFamilies genericFamily) [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.Drawing.FontFamily:.ctor (System.Drawing.Text.GenericFontFamilies)
  at System.Drawing.FontFamily.get_GenericSansSerif () [0x00000] in <filename unknown>:0 
  at System.Drawing.Font.CreateFont (System.String familyName, Single emSize, FontStyle style, GraphicsUnit unit, Byte charSet, Boolean isVertical) [0x00000] in <filename unknown>:0 
  at System.Drawing.Font..ctor (System.String familyName, Single emSize, FontStyle style, GraphicsUnit unit, Byte gdiCharSet, Boolean gdiVerticalFont) [0x00000] in <filename unknown>:0 
  at System.Drawing.Font..ctor (System.String familyName, Single emSize, System.String systemName) [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.Drawing.Font:.ctor (string,single,string)
  at System.Drawing.SystemFonts.get_DefaultFont () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Theme..ctor () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.ThemeWin32Classic..ctor () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.ThemeVisualStyles..ctor () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.ThemeEngine..cctor () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.Windows.Forms.SystemInformation.get_MenuAccessKeysUnderlined () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Control..ctor () [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control:.ctor ()
  at System.Windows.Forms.WindowsFormsSynchronizationContext..cctor () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.Windows.Forms.Control..ctor () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.ScrollableControl..ctor () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.ContainerControl..ctor () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Form..ctor () [0x00000] in <filename unknown>:0 
  at NewWorldStudio.StartupForm..ctor () [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) NewWorldStudio.StartupForm:.ctor ()
  at NewWorldStudio.Program.Main () [0x00000] in <filename unknown>:0 
未处理的异常:
System.TypeInitializationException:System.Windows.Forms.WindowsFormsSynchronizationContext的类型初始值设定项引发了异常-->System.TypeInitializationException:System.Windows.Forms.ThemeEngine的类型初始值设定项引发了异常-->System.ArgumentException:找不到请求的FontFamily[GDI+状态:FontFamilyNotFound]
在System.Drawing.GDIPlus.CheckStatus(状态状态)[0x00000]处输入:0
0中的System.Drawing.FontFamily..ctor(GenericFontFamilies genericFamily)[0x00000]处
在(包装器远程处理通过检查调用)System.Drawing.FontFamily:.ctor(System.Drawing.Text.GenericFontFamilies)
位于System.Drawing.FontFamily.get_GenericTransserif()[0x00000]中:0
在System.Drawing.Font.CreateFont(System.String familyName、Single emSize、FontStyle style、GraphicsUnit、字节字符集、布尔值isVertical)[0x00000]中:0
在System.Drawing.Font..ctor(System.String familyName、Single emSize、FontStyle style、GraphicsUnit、Byte gdiCharSet、Boolean gdiVerticalFont)[0x00000]中:0
在:0中的System.Drawing.Font..ctor(System.String familyName,Single-emSize,System.String systemName)[0x00000]处
在(包装器远程处理与检查调用)System.Drawing.Font:.ctor(字符串,单个,字符串)
在System.Drawing.SystemFonts.get_DefaultFont()[0x00000]中:0
位于:0中的System.Windows.Forms.Theme..ctor()[0x00000]处
在System.Windows.Forms.ThemeWin32Classic..ctor()[0x00000]中:0
在System.Windows.Forms.ThemeVisualStyles..ctor()[0x00000]中:0
0中的System.Windows.Forms.ThemeEngine..cctor()[0x00000]处
---内部异常堆栈跟踪的结束---
在System.Windows.Forms.SystemInformation.get_MenuAccessKeysUnderlined()[0x00000]中:0
位于:0中的System.Windows.Forms.Control..ctor()[0x00000]处
在(包装器远程处理与检查调用)System.Windows.Forms.Control:.ctor()
位于:0中的System.Windows.Forms.WindowsFormsSynchronizationContext..cctor()[0x00000]处
---内部异常堆栈跟踪的结束---
位于:0中的System.Windows.Forms.Control..ctor()[0x00000]处
在System.Windows.Forms.ScrollableControl..ctor()[0x00000]中:0
在System.Windows.Forms.ContainerControl..ctor()[0x00000]中:0
位于:0中的System.Windows.Forms.Form..ctor()[0x00000]处
在NewWorldStudio.StartupForm..ctor()[0x00000]中:0
在(带检查的包装器远程处理调用)NewWorldStudio.StartupForm:.ctor()
在NewWorldStudio.Program.Main()[0x00000]中:0
[错误]致命的未处理异常:System.TypeInitializationException:System.Windows.Forms.WindowsFormsSynchronizationContext的类型初始值设定项引发异常-->System.TypeInitializationException:System.Windows.Forms.ThemeEngine的类型初始值设定项引发异常-->System.ArgumentException:请求的FontFa找不到mily[GDI+状态:FontFamilyNotFound]
在System.Drawing.GDIPlus.CheckStatus(状态状态)[0x00000]处输入:0
0中的System.Drawing.FontFamily..ctor(GenericFontFamilies genericFamily)[0x00000]处
在(包装器远程处理通过检查调用)System.Drawing.FontFamily:.ctor(System.Drawing.Text.GenericFontFamilies)
位于System.Drawing.FontFamily.get_GenericTransserif()[0x00000]中:0
在System.Drawing.Font.CreateFont(System.String familyName、Single emSize、FontStyle style、GraphicsUnit、字节字符集、布尔值isVertical)[0x00000]中:0
在System.Drawing.Font..ctor(System.String familyName、Single emSize、FontStyle style、GraphicsUnit、Byte gdiCharSet、Boolean gdiVerticalFont)[0x00000]中:0
在:0中的System.Drawing.Font..ctor(System.String familyName,Single-emSize,System.String systemName)[0x00000]处
在(包装器远程处理与检查调用)System.Drawing.Font:.ctor(字符串,单个,字符串)
在System.Drawing.SystemFonts.get_DefaultFont()[0x00000]中:0
位于:0中的System.Windows.Forms.Theme..ctor()[0x00000]处
在System.Windows.Forms.ThemeWin32Classic..ctor()[0x00000]中:0
在System.Windows.Forms.ThemeVisualStyles..ctor()[0x00000]中:0
0中的System.Windows.Forms.ThemeEngine..cctor()[0x00000]处
---内部异常堆栈跟踪的结束---
在System.Windows.Forms.SystemInformation.get_MenuAccessKeysUnderlined()[0x00000]中:0
位于:0中的System.Windows.Forms.Control..ctor()[0x00000]处
在(包装器远程处理与检查调用)System.Windows.Forms.Control:.ctor()
位于:0中的System.Windows.Forms.WindowsFormsSynchronizationContext..cctor()[0x00000]处
---内部异常堆栈跟踪的结束---
位于:0中的System.Windows.Forms.Control..ctor()[0x00000]处
在System.Windows.Forms.ScrollableControl..ctor()[0x00000]中:0
在System.Windows.Forms.ContainerControl..ctor()[0x00000]中:0
位于:0中的System.Windows.Forms.Form..ctor()[0x00000]处
在NewWorldStudio.StartupForm..ctor()[0x00000]中:0
在(带检查的包装器远程处理调用)NewWorldStudio.StartupForm:.ctor()
在NewWorldStudio.Program.Main()[0x00000]中:0

在谷歌上很难找到解决方案。根据堆栈跟踪中的get_GenericSansSerif方法,它似乎与GDI+和Sans Serif字体有关。

可能是因为Mono的安装不正确。请再次尝试安装,并检查是否在OS X上安装了X11