VMware {code} Community
Selvalakshmi
Contributor
Contributor

Encountering an issue while using VixDiskLib_Connect

I'm encountering an issue while attempting to connect to an ESXi host using this code

[DllImport(VIXDISKLIB)]
public static extern VixError VixDiskLib_Connect(ref VixDiskLibConnectParams connectParams, out IntPtr connection);

private static VixError Connect(ConnectionInfo connectionInfo, out IntPtr connection)
{
try
{
VixDiskLibConnectParams connParams = new VixDiskLibConnectParams();
connParams.CredType = (uint)VixDiskLibCredType.VIXDISKLIB_CRED_UID;
connParams.VixCredentials = new VixDiskLibCreds();
connParams.VixCredentials.Uid = new VixDiskLibUidPasswdCreds();
connParams.ServerName = connectionInfo.Host;
connParams.VixCredentials.Uid.UserName = connectionInfo.UserName;
connParams.VixCredentials.Uid.Password = connectionInfo.Password;
connParams.Port = (uint)connectionInfo.Port;

return VixDiskLib.VixDiskLib_Connect(ref connParams, out connection);
}
catch (Exception)
{
throw;
}
}

Upon execution, it returns the following error:

Exception thrown at 0x00007FFE25270F50 (vcruntime140.dll) in Vm.Test.exe: 0xC0000005: Access violation reading location 0x0000000000000001.

Any suggestions to fix this issue would be helpful.

0 Kudos
1 Reply
Thessiscoved
Contributor
Contributor

Did you solve the problem?

Tags (1)
0 Kudos