title: Mono exceptions after compile on virtual host
body: <p>I have compiled mono to a local user on a Debian headless virtual host without sudo.</p>
  
  <p>I am getting the following thrown exception on running a program.</p>
  
  <pre><code>mono Program.exe
  </code></pre>
  
  <p>What is the origin of the exception below, and how do I resolve it?</p>
  
  <pre><code>Unhandled Exception:
  System.TypeInitializationException: The type initializer for 'System.Windows.Forms.WindowsFormsSynchronizationContext' threw an exception. ---&gt; System.TypeInitializationException: The type initializer for 'System.Windows.Forms.XplatUI' threw an exception. ---&gt; System.ArgumentNullException: Could not open display (X-Server required. Check your DISPLAY environment variable)
  Parameter name: Display
    at System.Windows.Forms.XplatUIX11.SetDisplay (IntPtr display_handle) &lt;0x40865c60 + 0x00b8f&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.XplatUIX11..ctor () &lt;0x40863f70 + 0x001df&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.XplatUIX11.GetInstance () &lt;0x40863da0 + 0x0005b&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.XplatUI..cctor () &lt;0x40863a70 + 0x0013b&gt; in &lt;filename unknown&gt;:0
    --- End of inner exception stack trace ---
    at System.Windows.Forms.Theme.get_MenuAccessKeysUnderlined () &lt;0x40863a20 + 0x0000f&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.SystemInformation.get_MenuAccessKeysUnderlined () &lt;0x4085f3f0 + 0x00017&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.Control..ctor () &lt;0x4085e0f0 + 0x0023b&gt; in &lt;filename unknown&gt;:0
    at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control:.ctor ()
    at System.Windows.Forms.WindowsFormsSynchronizationContext..cctor () &lt;0x4085f320 + 0x00023&gt; in &lt;filename unknown&gt;:0
    --- End of inner exception stack trace ---
    at System.Windows.Forms.Control..ctor () &lt;0x4085e0f0 + 0x00053&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.ScrollableControl..ctor () &lt;0x4085dbb0 + 0x00013&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.ContainerControl..ctor () &lt;0x4085da20 + 0x0002b&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.Form..ctor () &lt;0x4085d210 + 0x000b7&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.MessageBox+MessageBoxForm..ctor (IWin32Window owner, System.String text, System.String caption, MessageBoxButtons buttons, MessageBoxIcon icon, Boolean displayHelpButton) &lt;0x4085acb0 + 0x0008f&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.MessageBox+MessageBoxForm..ctor (IWin32Window owner, System.String text, System.String caption, MessageBoxButtons buttons, MessageBoxIcon icon) &lt;0x4085ac50 + 0x00047&gt; in &lt;filename unknown&gt;:0
    at (wrapper remoting-invoke-with-check) System.Windows.Forms.MessageBox+MessageBoxForm:.ctor (System.Windows.Forms.IWin32Window,string,string,System.Windows.Forms.MessageBoxButtons,System.Windows.Forms.MessageBoxIcon)
    at System.Windows.Forms.MessageBox.Show (System.String text) &lt;0x4085ab30 + 0x00043&gt; in &lt;filename unknown&gt;:0
    at Jackett.Program.Main (System.String[] args) &lt;0x40859a10 + 0x00107&gt; in &lt;filename unknown&gt;:0
  [ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for 'System.Windows.Forms.WindowsFormsSynchronizationContext' threw an exception. ---&gt; System.TypeInitializationException: The type initializer for 'System.Windows.Forms.XplatUI' threw an exception. ---&gt; System.ArgumentNullException: Could not open display (X-Server required. Check your DISPLAY environment variable)
  Parameter name: Display
    at System.Windows.Forms.XplatUIX11.SetDisplay (IntPtr display_handle) &lt;0x40865c60 + 0x00b8f&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.XplatUIX11..ctor () &lt;0x40863f70 + 0x001df&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.XplatUIX11.GetInstance () &lt;0x40863da0 + 0x0005b&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.XplatUI..cctor () &lt;0x40863a70 + 0x0013b&gt; in &lt;filename unknown&gt;:0
    --- End of inner exception stack trace ---
    at System.Windows.Forms.Theme.get_MenuAccessKeysUnderlined () &lt;0x40863a20 + 0x0000f&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.SystemInformation.get_MenuAccessKeysUnderlined () &lt;0x4085f3f0 + 0x00017&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.Control..ctor () &lt;0x4085e0f0 + 0x0023b&gt; in &lt;filename unknown&gt;:0
    at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control:.ctor ()
    at System.Windows.Forms.WindowsFormsSynchronizationContext..cctor () &lt;0x4085f320 + 0x00023&gt; in &lt;filename unknown&gt;:0
    --- End of inner exception stack trace ---
    at System.Windows.Forms.Control..ctor () &lt;0x4085e0f0 + 0x00053&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.ScrollableControl..ctor () &lt;0x4085dbb0 + 0x00013&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.ContainerControl..ctor () &lt;0x4085da20 + 0x0002b&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.Form..ctor () &lt;0x4085d210 + 0x000b7&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.MessageBox+MessageBoxForm..ctor (IWin32Window owner, System.String text, System.String caption, MessageBoxButtons buttons, MessageBoxIcon icon, Boolean displayHelpButton) &lt;0x4085acb0 + 0x0008f&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.MessageBox+MessageBoxForm..ctor (IWin32Window owner, System.String text, System.String caption, MessageBoxButtons buttons, MessageBoxIcon icon) &lt;0x4085ac50 + 0x00047&gt; in &lt;filename unknown&gt;:0
    at (wrapper remoting-invoke-with-check) System.Windows.Forms.MessageBox+MessageBoxForm:.ctor (System.Windows.Forms.IWin32Window,string,string,System.Windows.Forms.MessageBoxButtons,System.Windows.Forms.MessageBoxIcon)
    at System.Windows.Forms.MessageBox.Show (System.String text) &lt;0x4085ab30 + 0x00043&gt; in &lt;filename unknown&gt;:0
    at Jackett.Program.Main (System.String[] args) &lt;0x40859a10 + 0x00107&gt; in &lt;filename unknown&gt;:0
  nakedmancow@chronos:~/install/Release$ ls
  CsQuery.dll         Jackett.pdb                  Newtonsoft.Json.xml
  CsQuery.xml         Jackett.vshost.exe           NLog.dll
  CurlSharp.dll       Jackett.vshost.exe.config    NLog.xml
  CurlSharp.pdb       Jackett.vshost.exe.manifest  WebContent
  Jackett.exe         ModernHttpClient.dll
  Jackett.exe.config  Newtonsoft.Json.dll
  nakedmancow@chronos:~/install/Release$ mono Jackett.exe
  
  Unhandled Exception:
  System.TypeInitializationException: The type initializer for 'System.Windows.Forms.WindowsFormsSynchronizationContext' threw an exception. ---&gt; System.TypeInitializationException: The type initializer for 'System.Windows.Forms.XplatUI' threw an exception. ---&gt; System.ArgumentNullException: Could not open display (X-Server required. Check your DISPLAY environment variable)
  Parameter name: Display
    at System.Windows.Forms.XplatUIX11.SetDisplay (IntPtr display_handle) &lt;0x40bd0c60 + 0x00b8f&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.XplatUIX11..ctor () &lt;0x40bcef70 + 0x001df&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.XplatUIX11.GetInstance () &lt;0x40bceda0 + 0x0005b&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.XplatUI..cctor () &lt;0x40bcea70 + 0x0013b&gt; in &lt;filename unknown&gt;:0
    --- End of inner exception stack trace ---
    at System.Windows.Forms.Theme.get_MenuAccessKeysUnderlined () &lt;0x40bcea20 + 0x0000f&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.SystemInformation.get_MenuAccessKeysUnderlined () &lt;0x40bca3f0 + 0x00017&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.Control..ctor () &lt;0x40bc90f0 + 0x0023b&gt; in &lt;filename unknown&gt;:0
    at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control:.ctor ()
    at System.Windows.Forms.WindowsFormsSynchronizationContext..cctor () &lt;0x40bca320 + 0x00023&gt; in &lt;filename unknown&gt;:0
    --- End of inner exception stack trace ---
    at System.Windows.Forms.Control..ctor () &lt;0x40bc90f0 + 0x00053&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.ScrollableControl..ctor () &lt;0x40bc8bb0 + 0x00013&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.ContainerControl..ctor () &lt;0x40bc8a20 + 0x0002b&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.Form..ctor () &lt;0x40bc8210 + 0x000b7&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.MessageBox+MessageBoxForm..ctor (IWin32Window owner, System.String text, System.String caption, MessageBoxButtons buttons, MessageBoxIcon icon, Boolean displayHelpButton) &lt;0x40bc5cb0 + 0x0008f&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.MessageBox+MessageBoxForm..ctor (IWin32Window owner, System.String text, System.String caption, MessageBoxButtons buttons, MessageBoxIcon icon) &lt;0x40bc5c50 + 0x00047&gt; in &lt;filename unknown&gt;:0
    at (wrapper remoting-invoke-with-check) System.Windows.Forms.MessageBox+MessageBoxForm:.ctor (System.Windows.Forms.IWin32Window,string,string,System.Windows.Forms.MessageBoxButtons,System.Windows.Forms.MessageBoxIcon)
    at System.Windows.Forms.MessageBox.Show (System.String text) &lt;0x40bc5b30 + 0x00043&gt; in &lt;filename unknown&gt;:0
    at Jackett.Program.Main (System.String[] args) &lt;0x40bc4a10 + 0x00107&gt; in &lt;filename unknown&gt;:0
  [ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for 'System.Windows.Forms.WindowsFormsSynchronizationContext' threw an exception. ---&gt; System.TypeInitializationException: The type initializer for 'System.Windows.Forms.XplatUI' threw an exception. ---&gt; System.ArgumentNullException: Could not open display (X-Server required. Check your DISPLAY environment variable)
  Parameter name: Display
    at System.Windows.Forms.XplatUIX11.SetDisplay (IntPtr display_handle) &lt;0x40bd0c60 + 0x00b8f&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.XplatUIX11..ctor () &lt;0x40bcef70 + 0x001df&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.XplatUIX11.GetInstance () &lt;0x40bceda0 + 0x0005b&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.XplatUI..cctor () &lt;0x40bcea70 + 0x0013b&gt; in &lt;filename unknown&gt;:0
    --- End of inner exception stack trace ---
    at System.Windows.Forms.Theme.get_MenuAccessKeysUnderlined () &lt;0x40bcea20 + 0x0000f&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.SystemInformation.get_MenuAccessKeysUnderlined () &lt;0x40bca3f0 + 0x00017&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.Control..ctor () &lt;0x40bc90f0 + 0x0023b&gt; in &lt;filename unknown&gt;:0
    at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control:.ctor ()
    at System.Windows.Forms.WindowsFormsSynchronizationContext..cctor () &lt;0x40bca320 + 0x00023&gt; in &lt;filename unknown&gt;:0
    --- End of inner exception stack trace ---
    at System.Windows.Forms.Control..ctor () &lt;0x40bc90f0 + 0x00053&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.ScrollableControl..ctor () &lt;0x40bc8bb0 + 0x00013&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.ContainerControl..ctor () &lt;0x40bc8a20 + 0x0002b&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.Form..ctor () &lt;0x40bc8210 + 0x000b7&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.MessageBox+MessageBoxForm..ctor (IWin32Window owner, System.String text, System.String caption, MessageBoxButtons buttons, MessageBoxIcon icon, Boolean displayHelpButton) &lt;0x40bc5cb0 + 0x0008f&gt; in &lt;filename unknown&gt;:0
    at System.Windows.Forms.MessageBox+MessageBoxForm..ctor (IWin32Window owner, System.String text, System.String caption, MessageBoxButtons buttons, MessageBoxIcon icon) &lt;0x40bc5c50 + 0x00047&gt; in &lt;filename unknown&gt;:0
    at (wrapper remoting-invoke-with-check) System.Windows.Forms.MessageBox+MessageBoxForm:.ctor (System.Windows.Forms.IWin32Window,string,string,System.Windows.Forms.MessageBoxButtons,System.Windows.Forms.MessageBoxIcon)
    at System.Windows.Forms.MessageBox.Show (System.String text) &lt;0x40bc5b30 + 0x00043&gt; in &lt;filename unknown&gt;:0
    at Jackett.Program.Main (System.String[] args) &lt;0x40bc4a10 + 0x00107&gt; in &lt;filename unknown&gt;:0
  </code></pre>