We ran into library load failures when running ExchangeSharp on Linux (Ubuntu 20.04 running inside WSL2 on Windows 10). ExchangeSharp uses the “dlopen” call on Linux to dynamically load the libraries at runtime. This is provided by libdl.so. The P/Invoke call to “dlopen” was failing as it couldn’t find libdl.so.
We found a couple ways to fix this.
Install the libc6-dev package. This is an easy way to do it and as part of install it will create a symbolic link for you from libdl.so to libdl.so.2 but the downside is you’re installing development tools which you might not want for a deployable image (for example).
Manually create the symbolic link with the below.
ln -s /lib/x86_64-linux-gnu/libdl.so.2 /lib/x86_64-linux-gnu/libdl.so
Once we setup the symbolic link, ExchangeSharp was able to use “dlopen” to load the libraries. Posting this in case it helps someone else.