Attribute 'System.Runtime.InteropServices.DefaultCharSetAttribute' is not supported in this version

The System.Runtime.InteropServices.DefaultCharSetAttribute attribute allows you to specify the character set to be used in marshalled strings. Its value takes a member of the System.Runtime.InteropServices.CharSet enumeration.

The current version of Visual Basic does not support this attribute. Support is possible in future versions.

Error ID: BC32510

To correct this error

  • Use each Declare Statement to specify the character set for the external procedure it is declaring. The following example illustrates this.

    Ansi Declare Function GetUserName Lib "advapi32.dll" _  
        (ByVal lpBuffer As String, ByRef nSize As Integer) As Integer  
    Unicode Declare Sub externalProc Lib "projectlib.dll" _  
        (ByVal arg As Double)  
    

    If you do not specify the character set in the Declare statement, it defaults to ANSI.

See also