Search code examples
c#linuxvisual-studio-codeavaloniaui

Error message related to libICE.so.6 makes code to exit?


While working with avlaonia on Vscode and running it in debug. I get the below error message and the code exits and debug doesn't work.

System.DllNotFoundException: Unable to load shared library 'libICE.so.6' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable:
liblibICE.so.6: cannot open shared object file: No such file or directory
at Avalonia.X11.ICELib.IceAddConnectionWatch(IntPtr watchProc, IntPtr clientData)
at Avalonia.X11.X11PlatformLifetimeEvents..ctor(AvaloniaX11Platform platform) in /_/src/Avalonia.X11/X11PlatformLifetimeEvents.cs:line 56
at Avalonia.X11.AvaloniaX11Platform.Initialize(X11PlatformOptions options) in /_/src/Avalonia.X11/X11Platform.cs:line 71
at Avalonia.AvaloniaX11PlatformExtensions.<>c__0`1.<UseX11>b__0_0() in /_/src/Avalonia.X11/X11Platform.cs:line 279
at Avalonia.Controls.AppBuilderBase`1.Setup() in /_/src/Avalonia.Controls/AppBuilderBase.cs:line 303
at Avalonia.Controls.AppBuilderBase`1.SetupWithLifetime(IApplicationLifetime lifetime)

What does this error means, how can I managed to resolve the issue. This error appears any time I'm trying to run debug.


Solution

  • Try installing the package libice6:

    sudo apt install libice6
    

    For context, I just installed Linux Subsystem on Windows with Ubuntu, tried to run an avalonia program and ran into this error. It solved the problem (there was a subsequent missing library so I had to similarly run

    sudo apt install libsm6
    

    ). I hope it will help you