Hello,
I've come across what looks like a subtle bug in the Managed Library function ANT_VersionInfo.getUnmanagedLibraryVersion().
On some machines calling this was crashing the app with the exception 0xc0000374 (STATUS_HEAP_CORRUPTION).
I was only able to reproduce this reliably in our software on a few machines (adding this call to the demo app would work fine on the same machines).
The best explanation I could come up with was that it was a problem with how the unmanaged function was called. I was able to fix it by changing the p/invoke call to:
private static extern IntPtr getUnmanagedVersion();
and the managed wrapper to:
public static string getUnmanagedLibraryVersion()
{
IntPtr pStr = getUnmanagedVersion();
return Marshal.PtrToStringAnsi(pStr);
}
PtrToStringAnsi will make a copy of the string, where before the const string as being returned directly. My theory is that the crash was caused after .net tried to free the unmanaged memory. I am not sure why it only appeared in some situations though.
Regards,
Andrew