Anzeige konnte nicht geöffnet werden (X-Server erforderlich. Überprüfen Sie die DISPLAY-Variable)

1400
TheColonel26

Ich versuche, eine WinForm-Mono-App über die Befehlszeile ohne vollständige Desktop-Umgebung auszuführen. Es wird korrekt über SSH geöffnet (mithilfe von SmarTTY und X-Weiterleitung). Wenn ich jedoch versuche, es direkt auf dem PI auszuführen, bekomme ich dies.

Das Hauptaugenmerk lautet "Anzeige konnte nicht geöffnet werden (X-Server erforderlich. Überprüfen Sie die Variable DISPLAY)"

Nicht behandelte Ausnahme: System.InvalidOperationException: WinForms_SeeInnerException ---> System.TypeInitializationException: Eine Ausnahme wurde vom Typ-Initialisierer für System.Windows.Forms.WindowsFormsSynchronizationContext ---> System.TypeInitializationException: Eine Ausnahme vom Typ-Initialisierer für System ausgelöst .Windows.Forms.XplatUI ---> System.ArgumentNullException: Anzeige konnte nicht geöffnet werden (X-Server erforderlich. Überprüfen Sie die Umgebungsvariable DISPLAY). Parametername: Anzeige unter System.Windows.Forms.XplatUIX11.SetDisplay (IntPtr display_handle) [0x00000 ] in: 0 bei System.Windows.Forms.XplatUIX11..ctor () [0x00000] in: 0 bei System.Windows.Forms.XplatUIX11.GetInstance () [0x00000] in: 0 bei System.Windows.Forms.XplatUI. .cctor () [0x00000] in:0 --- Ende des inneren Ausnahme-Stack-Trace --- bei System.Windows.Forms.Theme.get_MenuAccessKeysUnderlined () [0x00000] in: 0 at System.Windows.Forms.SystemInformation.get_MenuAccessKeysUnderlined () [0x00000] in: 0 at System.Windows.Forms.Control..ctor () [0x00000] in: 0 um (Wrapper Remoting-Invoke-with-Check) System.Windows.Forms.Control: .ctor () unter System.Windows.Forms.WindowsFormsSynchronizationContext. .cctor () [0x00000] in: 0 --- Ende der inneren Ablaufverfolgung für Ausnahmebedingungsstapel --- unter System.Windows.Forms.Control..ctor () [0x00000] in: 0 unter System.Windows.Forms.ScrollableControl. .ctor () [0x00000] in: 0 bei System.Windows.Forms.ContainerControl..ctor () [0x00000] in: 0 bei System.Windows.Forms.Forms.ctor () [0x00000] in: 00 bei System.Windows.Forms.SystemInformation.get_MenuAccessKeysUnderlined () [0x00000] in: 0 bei System.Windows.Forms.Control..ctor () [0x00000] in: 0 bei (Wrapper-Remoting-Invoke-with-Check) System .Windows.Forms.Control: .ctor () unter System.Windows.Forms.WindowsFormsSynchronizationContext..cctor () [0x00000] in: 0 --- Ende des inneren Trace für Ausnahmebündel --- unter System.Windows.Forms.Control ..ctor () [0x00000] in: 0 bei System.Windows.Forms.ScrollableControl..ctor () [0x00000] in: 0 bei System.Windows.Forms.ContainerControl..ctor () [0x00000] in: 0 um System.Windows.Forms.Form..ctor () [0x00000] in: 00 bei System.Windows.Forms.SystemInformation.get_MenuAccessKeysUnderlined () [0x00000] in: 0 bei System.Windows.Forms.Control..ctor () [0x00000] in: 0 bei (Wrapper-Remoting-Invoke-with-Check) System .Windows.Forms.Control: .ctor () unter System.Windows.Forms.WindowsFormsSynchronizationContext..cctor () [0x00000] in: 0 --- Ende des inneren Trace für Ausnahmebündel --- unter System.Windows.Forms.Control ..ctor () [0x00000] in: 0 bei System.Windows.Forms.ScrollableControl..ctor () [0x00000] in: 0 bei System.Windows.Forms.ContainerControl..ctor () [0x00000] in: 0 um System.Windows.Forms.Form..ctor () [0x00000] in: 0Forms.Control: .ctor () unter System.Windows.Forms.WindowsFormsSynchronizationContext..cctor () [0x00000] in: 0 --- Ende des inneren Trace für Ausnahmestapel --- unter System.Windows.Forms.Control..ctor () [0x00000] in: 0 bei System.Windows.Forms.ScrollableControl..ctor () [0x00000] in: 0 bei System.Windows.Forms.ContainerControl..ctor () [0x00000] in: 0 bei System.Windows .Forms.Form..ctor () [0x00000] in: 0Forms.Control: .ctor () unter System.Windows.Forms.WindowsFormsSynchronizationContext..cctor () [0x00000] in: 0 --- Ende des inneren Trace für Ausnahmestapel --- unter System.Windows.Forms.Control..ctor () [0x00000] in: 0 bei System.Windows.Forms.ScrollableControl..ctor () [0x00000] in: 0 bei System.Windows.Forms.ContainerControl..ctor () [0x00000] in: 0 bei System.Windows .Forms.Form..ctor () [0x00000] in: 0
at MfgControl.AdvancedHMI.MainForm..ctor () [0x00000] in: 0 at (vom Wrapper verwalteter-zu-nativer Server) System.Reflection.MonoCMethod: InternalInvoke (System.Reflection.MonoCMethod, object, object [], System.Exception &) at System.Reflection.MonoCMethod.InternalInvoke (Parameter System.Object obj, System.Object []) [0x00000] in: 0 --- Ende des inneren Trace für Ausnahmestapel --- at MfgControl.AdvancedHMI.My.MyProject + MyForms. Create__Instay __ [MainForm] (MfgControl.AdvancedHMI.MainForm-Instanz) [0x00000] in: 0 um MfgControl.AdvancedHMI.My.My.MyProject + MyForms.get_MainForm () [0x00000] in: 0 um MfgControl.AdvancedHMI.Chain.Ch. [0x00000] in: 0 um Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun () [0x00000] in: 0 um Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run (System.String [] commandLine) [0x00000] in: 0 um MfgControl.AdvancedHMI.My.MyApplication.Main (System.String [] Args) [0x00000] in: 0 [ERROR] FATAL UNHANDLED EXCEPTION: System. InvalidOperationException: WinForms_SeeInnerException ---> System.TypeInitializationException: Eine Ausnahme wurde vom Typinitialisierer für System.Windows.Forms.WindowsFormsSynchronizationContext ---> System.TypeInitializationException: Vom Systeminitialisierer für System.Windows.Forms ausgelöst. XplatUI ---> System.ArgumentNullException: Anzeige konnte nicht geöffnet werden (X-Server erforderlich. Überprüfen Sie die Umgebungsvariable DISPLAY). Parametername: Anzeige unter System.Windows.Forms.XplatUIX11.SetDisplay (IntPtr display_handle) [0x00000] in: 0 um System.Windows.Forms.XplatUIX11 ..ctor () [0x00000] in: 0 bei System.Windows.Forms.XplatUIX11.GetInstance () [0x00000] in: 0 bei System.Windows.Forms.XplatUI..cctor () [0x00000] in: 0 --- Ende des inneren Ausnahmestapel-Trace --- bei System.Windows.Forms.Theme.get_MenuAccessKeysUnderlined () [0x00000] in: 0 bei System.Windows.Forms.SystemInformation.get_MenuAccessKeysUnderlined () [0x00000] in: 0 bei System.Windows.Forms .Control..ctor () [0x00000] in: 0 um (Wrapper Remoting-Invoke-with-Check) System.Windows.Forms.Control: .ctor () unter System.Windows.Forms.WindowsFormsSynchronizationContext..cctor () [ 0x00000] in: 0 --- Ende des inneren Ausnahmestapel-Trace --- bei System.Windows.Forms.Control..ctor () [0x00000] in: 0 bei System.Windows.Forms.ScrollableControl..ctor () [ 0x00000] in: 0 unter System.Windows.Forms.ContainerControl ..ctor () [0x00000] in: 0 bei System.Windows.Forms.Forms.ctor () [0x00000] in: 0
at MfgControl.AdvancedHMI.MainForm..ctor () [0x00000] in: 0 at (vom Wrapper verwalteter-zu-nativer Server) System.Reflection.MonoCMethod: InternalInvoke (System.Reflection.MonoCMethod, object, object [], System.Exception &) at System.Reflection.MonoCMethod.InternalInvoke (Parameter System.Object obj, System.Object []) [0x00000] in: 0 --- Ende des inneren Trace für Ausnahmestapel --- at MfgControl.AdvancedHMI.My.MyProject + MyForms. Create__Instay __ [MainForm] (MfgControl.AdvancedHMI.MainForm-Instanz) [0x00000] in: 0 um MfgControl.AdvancedHMI.My.My.MyProject + MyForms.get_MainForm () [0x00000] in: 0 um MfgControl.AdvancedHMI.Chain.Ch. [0x00000] in: 0 um Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun () [0x00000] in: 0 um Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run (System.String [] commandLine) [0x00000] in: 0 um MfgControl.AdvancedHMI.My.MyApplication.Main (System.String [] Args) [0x00000] in: 0

0
Ihr Textbild [ist nicht sehr hilfreich] (// meta.unix.stackexchange.com/q/4086). Es kann nicht in einen Editor kopiert werden und indiziert nicht sehr gut, was bedeutet, dass andere Benutzer mit dem gleichen Problem weniger wahrscheinlich die Antwort hier finden. Bitte [bearbeiten] Sie Ihren Beitrag, um den relevanten Text direkt einzubinden (vorzugsweise mit Kopieren + Einfügen, um Transkriptionsfehler zu vermeiden). Toby Speight vor 7 Jahren 0

1 Antwort auf die Frage

1
user2183032

Sie haben keinen X-Server, der ausgeführt wird. Ohne X-Server gibt es keine Anzeige, an die die Anwendung gebunden werden kann.

Gibt es eine Möglichkeit, den X-Server zu starten und meine App mit demselben Befehl auszuführen? TheColonel26 vor 7 Jahren 0
Haben Sie einen Xserver installiert? Minimale CLI-Installationen (z. B. keine Desktop-Umgebung) werden selten mitgeliefert. Produziert startx Ergebnisse? user2183032 vor 7 Jahren 0
Ich mache jetzt. Ich habe jedoch noch nicht herausgefunden, wie ich meine Mono-App auf einem X-Server mit einer Zeile starten kann. Ich habe dazu ein Shell-Skript erstellt. "#! / bin / bash export DISPLAY =: 0 X -nocursor -s 0 -dpms & mono /app/AdvancedHMI.exe&" TheColonel26 vor 7 Jahren 0
startx && anwendung user2183032 vor 7 Jahren 0
Ich habe das versucht. Es startet nur den x-Server und ignoriert den zweiten Teil der Zeile. TheColonel26 vor 7 Jahren 0
Ihr Skript hat nur 1 &, Sie benötigen 2 (&&), um beide Befehle auszuführen. Sein wahrscheinliches X ist an das Terminal gebunden und verhindert, dass weiterer Code ausgeführt wird. Möglicherweise müssen Sie den Befehl in eine Gnome-Terminalsitzung weiterleiten. user2183032 vor 7 Jahren 0
Lassen Sie uns [diese Diskussion im Chat fortsetzen] (http://chat.stackexchange.com/rooms/45984/discussion-between-thecolonel26-and-user2183032). TheColonel26 vor 7 Jahren 0