/// <summary> /// Helper method that extracts a string from the pointer returned /// by the cpp plugin and frees the associated memory of the C++ string /// </summary> /// <param name="message"></param> /// <returns></returns> private string ExtractFailureMessage(IntPtr message) { var errorMessage = Marshal.PtrToStringAnsi(message); NativeInterface.FreeErrorMessage(message); return(errorMessage); }