Beim Ausführen/Installieren von NuGet tritt eine unbehandelte Ausnahme auf.

Beim Ausführen/Installieren von NuGet tritt eine unbehandelte Ausnahme auf.

Ich versuche, Nuget auf Ubuntu 18.04.2 LTS zu installieren. Ich erhalte Fehlermeldungen und weiß nicht, wie ich diesen Zustand beheben kann.

nuget wird nicht gestartet, es gibt den folgenden Unhandled Exception-Fehler aus System.Console.

Unhandled Exception:
System.TypeInitializationException: The type initializer for 'System.Console' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.ConsoleDriver' threw an exception. ---> System.DllNotFoundException: System.Native
  at (wrapper managed-to-native) Interop+Sys.Stat(byte&,Interop/Sys/FileStatus&)
  at Interop+Sys.Stat (System.ReadOnlySpan`1[T] path, Interop+Sys+FileStatus& output) [0x00028] in <81342d83acda4c5590ec19c7afdf26b9>:0
  at System.IO.FileSystem.FileExists (System.ReadOnlySpan`1[T] fullPath, System.Int32 fileType, Interop+ErrorInfo& errorInfo) [0x00007] in <81342d83acda4c5590ec19c7afdf26b9>:0
  at System.IO.FileSystem.DirectoryExists (System.ReadOnlySpan`1[T] fullPath, Interop+ErrorInfo& errorInfo) [0x00000] in <81342d83acda4c5590ec19c7afdf26b9>:0
  at System.IO.FileSystem.DirectoryExists (System.ReadOnlySpan`1[T] fullPath) [0x00000] in <81342d83acda4c5590ec19c7afdf26b9>:0
  at System.IO.Directory.Exists (System.String path) [0x0001e] in <81342d83acda4c5590ec19c7afdf26b9>:0
  at System.TermInfoDriver.SearchTerminfo (System.String term) [0x00044] in <81342d83acda4c5590ec19c7afdf26b9>:0
  at System.TermInfoDriver..ctor (System.String term) [0x0004b] in <81342d83acda4c5590ec19c7afdf26b9>:0
  at System.ConsoleDriver.CreateTermInfoDriver (System.String term) [0x00000] in <81342d83acda4c5590ec19c7afdf26b9>:0
  at System.ConsoleDriver..cctor () [0x0004d] in <81342d83acda4c5590ec19c7afdf26b9>:0
   --- End of inner exception stack trace ---
  at System.Console.SetupStreams (System.Text.Encoding inputEncoding, System.Text.Encoding outputEncoding) [0x00007] in <81342d83acda4c5590ec19c7afdf26b9>:0
  at System.Console..cctor () [0x0007d] in <81342d83acda4c5590ec19c7afdf26b9>:0
   --- End of inner exception stack trace ---
  at NuGet.Program.Main (System.String[] args) [0x00005] in <dc8a236afba24badbb185682f8956bec>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for 'System.Console' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.ConsoleDriver' threw an exception. ---> System.DllNotFoundException: System.Native
  at (wrapper managed-to-native) Interop+Sys.Stat(byte&,Interop/Sys/FileStatus&)
  at Interop+Sys.Stat (System.ReadOnlySpan`1[T] path, Interop+Sys+FileStatus& output) [0x00028] in <81342d83acda4c5590ec19c7afdf26b9>:0
  at System.IO.FileSystem.FileExists (System.ReadOnlySpan`1[T] fullPath, System.Int32 fileType, Interop+ErrorInfo& errorInfo) [0x00007] in <81342d83acda4c5590ec19c7afdf26b9>:0
  at System.IO.FileSystem.DirectoryExists (System.ReadOnlySpan`1[T] fullPath, Interop+ErrorInfo& errorInfo) [0x00000] in <81342d83acda4c5590ec19c7afdf26b9>:0
  at System.IO.FileSystem.DirectoryExists (System.ReadOnlySpan`1[T] fullPath) [0x00000] in <81342d83acda4c5590ec19c7afdf26b9>:0
  at System.IO.Directory.Exists (System.String path) [0x0001e] in <81342d83acda4c5590ec19c7afdf26b9>:0
  at System.TermInfoDriver.SearchTerminfo (System.String term) [0x00044] in <81342d83acda4c5590ec19c7afdf26b9>:0
  at System.TermInfoDriver..ctor (System.String term) [0x0004b] in <81342d83acda4c5590ec19c7afdf26b9>:0
  at System.ConsoleDriver.CreateTermInfoDriver (System.String term) [0x00000] in <81342d83acda4c5590ec19c7afdf26b9>:0
  at System.ConsoleDriver..cctor () [0x0004d] in <81342d83acda4c5590ec19c7afdf26b9>:0
   --- End of inner exception stack trace ---
  at System.Console.SetupStreams (System.Text.Encoding inputEncoding, System.Text.Encoding outputEncoding) [0x00007] in <81342d83acda4c5590ec19c7afdf26b9>:0
  at System.Console..cctor () [0x0007d] in <81342d83acda4c5590ec19c7afdf26b9>:0
   --- End of inner exception stack trace ---
  at NuGet.Program.Main (System.String[] args) [0x00005] in <dc8a236afba24badbb185682f8956bec>:0

Um das Problem zu beheben, habe ich Folgendes getan:

sudo apt --fix-broken install -y >log.txt 2>&1

Und hier ist die log.txt. Tut mir leid, sie ist brutal lang, aber ich bin mir nicht sicher, welche Teile davon relevant sind.

ACHTUNG: apt hat keine stabile CLI-Schnittstelle. In Skripten mit Vorsicht verwenden.

Paketlisten werden gelesen...
Abhängigkeitsbaum wird erstellt ...
Statusinformationen werden gelesen...
Abhängigkeiten werden korrigiert... Fertig
Die folgenden Pakete wurden automatisch installiert und werden nicht mehr benötigt:
  apt-clone archdetect-deb busybox-static cryptsetup-bin dpkg-repack
  gir1.2-timezonemap-1.0 gir1.2-xkl-1.0 grub-common kde-window-manager kinit
  kio kpackagetool5 kwayland-Daten kwin-common kwin-Daten kwin-x11
  libdebian-installer4 libkdecorations2-5v5 libkdecorations2private5v5
  libkf5activities5 libkf5attica5 libkf5completion-data libkf5completion5
  libkf5deklarative-daten libkf5declarative5 libkf5doctools5
  libkf5globalaccel-Daten libkf5globalaccel5 ​​libkf5globalaccelprivate5
  libkf5idletime5 libkf5jobwidgets-Daten libkf5jobwidgets5 libkf5kcmutils-Daten
  libkf5kcmutils5 libkf5kiocore5 libkf5kiontlm5 libkf5kiowidgets5
  libkf5newstuff-Daten libkf5newstuff5 libkf5newstuffcore5 libkf5Paketdaten
  libkf5package5 libkf5plasma5 libkf5quickaddons5 libkf5solid5
  libkf5solid5-data libkf5sonnet5-data libkf5sonnetcore5 libkf5sonnetui5
  libkf5textwidgets-data libkf5textwidgets5 libkf5waylandclient5
  libkf5waylandserver5 libkf5xmlgui-bin libkf5xmlgui-data libkf5xmlgui5
  libkscreenlocker5 libkwin4-Effekt-Builtins1 libkwineffects11
  libkwinglutils11 libkwinxrenderutils11
  libmono-system-runtime-interopservices-runtimeinformation4.0-cil
  libnunit-cil-dev libnunit-konsole-runner2.6.3-cil
  libnunit-core-schnittstellen2.6.3-cil libnunit-core2.6.3-cil
  libnunit-framework2.6.3-cil libnunit-mocks2.6.3-cil libnunit-util2.6.3-cil
  libqgsttools-p1 libqt5designer5 libqt5help5 libqt5multimedia5
  libqt5multimedia5-plugins libqt5multimediaquick-p5 libqt5multimediawidgets5
  libqt5opengl5 libqt5positioning5 libqt5printsupport5 libqt5qml5 libqt5quick5
  libqt5quickwidgets5 libqt5sensors5 libqt5sql5 libqt5test5 libqt5webchannel5
  libqt5webkit5 libxcb-composite0 libxcb-cursor0 libxcb-damage0 os-prober
  python3-dbus.mainloop.pyqt5 python3-icu python3-pam python3-pyqt5
  python3-pyqt5.qtsvg python3-pyqt5.qtwebkit python3-sip
  qml-module-org-kde-kquickcontrolsaddons qml-module-qtmultimedia
  qml-modul-qtquick2 rdate
Verwenden Sie „sudo apt autoremove“, um sie zu entfernen.
Die folgenden zusätzlichen Pakete werden installiert:
  CA-Zertifikate-Mono
Die folgenden Pakete werden aktualisiert:
  CA-Zertifikate-Mono
debconf: Verzögerung der Paketkonfiguration, da apt-utils nicht installiert ist
1 aktualisiert, 0 neu installiert, 0 zu entfernen und 278 nicht aktualisiert.
157 nicht vollständig installiert oder entfernt.
Es müssen 0 B/31,2 kB an Archiven abgerufen werden.
Nach diesem Vorgang werden 4.096 B Speicherplatz freigegeben.
Mono-Gac (6.0.0.313-0xamarin3+ubuntu1804b1) wird eingerichtet …
* Installieren von 1 Assembly von libnewtonsoft-json5.0-cil in Mono

Unbehandelte Ausnahme:
System.DllNotFoundException: System.Native
  bei (Wrapper von verwaltet zu nativ) Interop+Sys.Stat(Byte&,Interop/Sys/FileStatus&)
  bei Interop+Sys.Stat (System.ReadOnlySpan`1[T] Pfad, Interop+Sys+FileStatus& Ausgabe) [0x00028] in: 0
  bei System.IO.FileSystem.FileExists (System.ReadOnlySpan`1[T] fullPath, System.Int32 fileType, Interop+ErrorInfo& errorInfo) [0x00007] in: 0
  bei System.IO.FileSystem.FileExists (System.ReadOnlySpan`1[T] fullPath) [0x00006] in: 0
  bei System.IO.File.Exists (System.String-Pfad) [0x00043] in: 0
  bei Mono.Tools.Driver.LoadConfig (System.Boolean quiet) [0x00028] in: 0
  bei Mono.Tools.Driver.Main (System.String[] args) [0x00351] in: 0
[FEHLER] SCHWERWIEGENDE, UNBEHANDELTE AUSNAHME: System.DllNotFoundException: System.Native
  bei (Wrapper von verwaltet zu nativ) Interop+Sys.Stat(Byte&,Interop/Sys/FileStatus&)
  bei Interop+Sys.Stat (System.ReadOnlySpan`1[T] Pfad, Interop+Sys+FileStatus& Ausgabe) [0x00028] in: 0
  bei System.IO.FileSystem.FileExists (System.ReadOnlySpan`1[T] fullPath, System.Int32 fileType, Interop+ErrorInfo& errorInfo) [0x00007] in: 0
  bei System.IO.FileSystem.FileExists (System.ReadOnlySpan`1[T] fullPath) [0x00006] in: 0
  bei System.IO.File.Exists (System.String-Pfad) [0x00043] in: 0
  bei Mono.Tools.Driver.LoadConfig (System.Boolean quiet) [0x00028] in: 0
  bei Mono.Tools.Driver.Main (System.String[] args) [0x00351] in: 0
E: Installation der Assembly /usr/lib/cli/Newtonsoft.Json-5.0/Newtonsoft.Json.dll ist fehlgeschlagen
E: Die Installation von libnewtonsoft-json5.0-cil mit /usr/share/cli-common/runtimes.d/mono ist fehlgeschlagen
* Installieren von 1 Assembly von libnunit-console-runner2.6.3-cil in Mono

...viele ähnliche Ausnahmen entfernt...

Unbehandelte Ausnahme:
System.DllNotFoundException: System.Native
  bei (Wrapper von verwaltet zu nativ) Interop+Sys.Stat(Byte&,Interop/Sys/FileStatus&)
  bei Interop+Sys.Stat (System.ReadOnlySpan`1[T] Pfad, Interop+Sys+FileStatus& Ausgabe) [0x00028] in: 0
  bei System.IO.FileSystem.FileExists (System.ReadOnlySpan`1[T] fullPath, System.Int32 fileType, Interop+ErrorInfo& errorInfo) [0x00007] in: 0
  bei System.IO.FileSystem.FileExists (System.ReadOnlySpan`1[T] fullPath) [0x00006] in: 0
  bei System.IO.File.Exists (System.String-Pfad) [0x00043] in: 0
  bei Mono.Tools.Driver.LoadConfig (System.Boolean quiet) [0x00028] in: 0
  bei Mono.Tools.Driver.Main (System.String[] args) [0x00351] in: 0
[FEHLER] SCHWERWIEGENDE, UNBEHANDELTE AUSNAHME: System.DllNotFoundException: System.Native
  bei (Wrapper von verwaltet zu nativ) Interop+Sys.Stat(Byte&,Interop/Sys/FileStatus&)
  bei Interop+Sys.Stat (System.ReadOnlySpan`1[T] Pfad, Interop+Sys+FileStatus& Ausgabe) [0x00028] in: 0
  bei System.IO.FileSystem.FileExists (System.ReadOnlySpan`1[T] fullPath, System.Int32 fileType, Interop+ErrorInfo& errorInfo) [0x00007] in: 0
  bei System.IO.FileSystem.FileExists (System.ReadOnlySpan`1[T] fullPath) [0x00006] in: 0
  bei System.IO.File.Exists (System.String-Pfad) [0x00043] in: 0
  bei Mono.Tools.Driver.LoadConfig (System.Boolean quiet) [0x00028] in: 0
  bei Mono.Tools.Driver.Main (System.String[] args) [0x00351] in: 0
E: Die Installation der Assembly /usr/share/cli-common/policies.d/libnewtonsoft-json5.0-cil/policy.5.0.Newtonsoft.Json.dll ist fehlgeschlagen
E: Die Installation von policy.5.0.Newtonsoft.Json mit /usr/share/cli-common/runtimes.d/mono ist fehlgeschlagen
dpkg: Fehler beim Verarbeiten des Pakets mono-gac (--configure):
 Der installierte Mono-GAC-Paket-Nachinstallationsskript-Unterprozess hat den Fehler-Exit-Status 29 zurückgegeben.
dpkg: Abhängigkeitsprobleme verhindern Konfiguration von mono-runtime-common:
 mono-runtime-common hängt von mono-gac (= 6.0.0.313-0xamarin3+ubuntu1804b1) ab; jedoch:
  Paket mono-gac ist noch nicht konfiguriert.

dpkg: Fehler bei der Verarbeitung des Pakets mono-runtime-common (--configure):
 Abhängigkeitsprobleme - unkonfiguriert lassen
Es wurde kein Apport-Bericht geschrieben, da die Fehlermeldung darauf hinweist, dass es sich um einen Folgefehler eines vorherigen Fehlers handelt.
Bei der Verarbeitung sind Fehler aufgetreten:
 mono-gac
 mono-runtime-common
E: Der Unterprozess /usr/bin/dpkg hat einen Fehlercode zurückgegeben (1)

Antwort1

Ich bin auch bei einem Skript darauf gestoßen, das zuvor einwandfrei funktioniert hat. Dies ist auf ein Mono-Upgrade von 5.18.0.x auf 6.0.0 zurückzuführen, das kürzlich veröffentlicht wurde (14. Juli 2019).

Ich konnte den Fehler sowohl mit NuGet 4.7.0.5148 (unter OSX) als auch mit 5.1.0.6013 (unter Ubuntu 18.04) reproduzieren.

Nachdem ich Mono auf meinem Mac auf 5.18.1 herunterstufen konnte, funktionierte das Skript wieder. Ich hänge derzeit allerdings immer noch bei Ubuntu 18.04 fest, da das heruntergestufte Mono jetzt auf libc-Ausnahmen stößt.

verwandte Informationen