valuePtr = System.Runtime.InteropServices.Marshal.SecureStringToGlobalAllocUnicode(SecureString);
You passed as parameter "SecureString", which is a type
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello,
Just want to check if Marshal.SecureStringToGlobalAllocUnicode(SecureString); is supported in .NET 4.5 . I keep getting the above error that Marshall doesnt contain a definition for SecureStringToGlobalAllocUnicode .
https://video2.skills-academy.com/en-us/dotnet/api/system.runtime.interopservices.marshal.securestringtoglobalallocunicode?view=netframework-4.5#System_Runtime_InteropServices_Marshal_SecureStringToGlobalAllocUnicode_System_Security_SecureString_
This is the code that I was using, which is giving the error.
using System.Security;
using System.Runtime.InteropServices;
IntPtr valuePtr = IntPtr.Zero;
try
{
valuePtr = System.Runtime.InteropServices.Marshal.SecureStringToGlobalAllocUnicode(SecureString);
exportedString = System.Runtime.InteropServices.Marshal.PtrToStringUni(valuePtr);
}
finally
{
Marshal.ZeroFreeGlobalAllocUnicode(valuePtr);
}
valuePtr = System.Runtime.InteropServices.Marshal.SecureStringToGlobalAllocUnicode(SecureString);
You passed as parameter "SecureString", which is a type