i ont une structureerreur Marshal.SizeOf taille de calcul
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;
}
J'obtiens l'erreur suivante
System.ArgumentException a été unhandled message = "Type 'SERVER_USB_DEVICE' ne peut pas être marshalé comme une structure non gérée , aucune taille significative ou décalage peut être calculé. "
à la ligne suivante
Marshal.SizeOf(typeof(USBOverNetWrapper.FT_SERVER_USB_DEVICE));
ce qui est faux dans le code?
Abdul Khaliq
Montrez-nous l'attribut avec votre struct. – adatapost