i have a structure
public struct SERVER_USB_DEVICE
{
USB_HWID usbHWID;
byte status;
bool bExcludeDevice;
bool bSharedManually;
ulong ulDeviceId;
ulong ulClientAddr;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)]
string usbDeviceDescr;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)]
string locationInfo;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)]
string nickName;
}
i am getting following error
System.ArgumentException was unhandled
Message=”Type ‘SERVER_USB_DEVICE’
cannot be marshaled as an unmanaged
structure; no meaningful size or
offset can be computed.”
at following line
Marshal.SizeOf(typeof(USBOverNetWrapper.FT_SERVER_USB_DEVICE));
what is wrong in the code?
Abdul Khaliq
However I recommend you use this one instead: