-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Log version of libgdiplus to the console in System.Drawing.Common.Tests #29625
Comments
To get the version, the portable approaches seem to be returning ldconfig -v 2> /dev/null | grep libgdiplus
# => libgdiplus.so.0 -> libgdiplus.so.0.0.0
readelf -d `find / -name libgdiplus.so 2> /dev/null` | grep SONAME
# => 0x000000000000000e (SONAME) Library soname: [libgdiplus.so.0] (usually these are enough for libs that are using proper semantic versioning) For Debian and derived OSes, perhaps something like this would do the job: using System;
using System.Diagnostics;
public class Test
{
public static void Main()
{
try
{
using(var process = Process.Start(new ProcessStartInfo
{
FileName = "dpkg-query",
Arguments = "--showformat '${Version}' --show libgdiplus",
RedirectStandardOutput = true,
UseShellExecute = false
}))
{
process.WaitForExit();
Console.WriteLine(process.StandardOutput.ReadToEnd());
}
}
catch(Exception ex)
{
Console.WriteLine("Unable to determine libgdiplus version using `dpkg-query`. exception: {0}", ex);
}
}
} prints |
Does this not work?
|
If we compile libgdiplus, then the version API shows up: # ubuntu
apt install -y libtool libjpeg-dev libtiff-dev libcairo2-dev libglib2.0-dev git autoconf
git clone https://github.com/mono/libgdiplus --single-branch --branch master --depth 1
cd libgdiplus
./autogen.sh
make install
readelf -Ws src/.libs/libgdiplus.so.0 | grep Version
252: 0000000000016b90 12 FUNC GLOBAL DEFAULT 12 GetLibgdiplusVersion
1257: 0000000000016b90 12 FUNC GLOBAL DEFAULT 12 GetLibgdiplusVersion |
Ah, I didn't notice it wasn't there yet. Yeah I guess we would have to do different things on different systems 😞 |
@am11 do you want to give it a try and submit a PR to add the libgdiplus version logging? This would really help us diagnose a few crashes. |
Closing this issue as System.Drawing.Common is only supported on Windows now. |
We've hit various situations that we wanted to know the version of libgdiplus that was used for a test run. So logging it to the console on startup of the System.Drawing.Common.Tests when running in a non-Windows environment would be really useful.
Maybe
void WINGDIPAPI GdiplusShutdown (ULONG_PTR token);
can be used to do so.We do that already in InteropServices tests: https://github.com/dotnet/corefx/blob/008d21c47c22b5757e09f6c3d346998004a0f985/src/System.Runtime.InteropServices.RuntimeInformation/tests/DescriptionNameTests.cs#L16
cc: @danmosemsft @filipnavara
The text was updated successfully, but these errors were encountered: