You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Apps that took dependency on libcoreclr.so fail in single file mode #41859
This obviously fails in single file mode where libcoreclr.so doesn't exist:
Curses failed to initialize, the exception is: System.DllNotFoundException: Unable to load shared library 'libcoreclr.so' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibcoreclr.so: cannot open shared object file: No such file or directory
at Mono.Terminal.Internal.UnmanagedLibrary.CoreCLR.dlopen(String filename, Int32 flags)
at Mono.Terminal.Internal.UnmanagedLibrary.PlatformSpecificLoadLibrary(String libraryPath)
at Mono.Terminal.Internal.UnmanagedLibrary..ctor(String[] libraryPathAlternatives, Boolean isFullPath)
at Unix.Terminal.Curses.LoadMethods()
at Unix.Terminal.Curses.FindNCurses()
at Unix.Terminal.Curses.initscr()
at Terminal.Gui.CursesDriver.Init(Action terminalResized)
Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
at Unix.Terminal.Curses.raw()
at Terminal.Gui.CursesDriver.Init(Action terminalResized)
at Terminal.Gui.Application.Init(Func`1 topLevelFactory)
at Terminal.Gui.Application.Init()
at Demo.Main()
Aborted
/// <summary>/// Similarly as for Mono on Linux, we load symbols for/// dlopen and dlsym from the "libcoreclr.so",/// to avoid the dependency on libc-dev Linux./// </summary>staticclassCoreCLR{[DllImport("libcoreclr.so")]internalstaticexternIntPtrdlopen(stringfilename,intflags);[DllImport("libcoreclr.so")]internalstaticexternIntPtrdlsym(IntPtrhandle,stringsymbol);}
This should be fixed in the library. In the meantime, I believe that this can be worked around in the app by subscribing to AssemblyLoadContext.ResolvingUnmanagedDll event and rerouting libcoreclr.so.
No. If we start adding compatibility quirks like this to runtime to virtualize the environment, we won't know where to stop.
Agreed. Fundamentally we need to have a set of supported API points and focus on that. PInvoking coreclr.dll is not one of those, it's simply an implementation detail.
Activity
benaadams commentedon Sep 4, 2020
https://github.com/migueldeicaza/gui.cs/blob/91a86c9460751dd0ed40ee8945b12f6cdb33b5fd/Terminal.Gui/ConsoleDrivers/CursesDriver/UnmanagedLibrary.cs#L254-L266
benaadams commentedon Sep 4, 2020
It looks to be to avoid a runtime dependency on
libc-devwhich it takes for the non-Mono, non-CoreCLR path https://github.com/migueldeicaza/gui.cs/blob/91a86c9460751dd0ed40ee8945b12f6cdb33b5fd/Terminal.Gui/ConsoleDrivers/CursesDriver/UnmanagedLibrary.cs#L220-L227jkotas commentedon Sep 4, 2020
No. If we start adding compatibility quirks like this to runtime to virtualize the environment, we won't know where to stop. https://github.com/dotnet/designs/blob/master/accepted/2020/form-factors.md#single-file
This should be fixed in the library. In the meantime, I believe that this can be worked around in the app by subscribing to
AssemblyLoadContext.ResolvingUnmanagedDllevent and rerouting libcoreclr.so.agocke commentedon Sep 4, 2020
Agreed. Fundamentally we need to have a set of supported API points and focus on that. PInvoking
coreclr.dllis not one of those, it's simply an implementation detail.