CA2101 Warning when making extern calls

前端 未结 1 1690
轮回少年
轮回少年 2021-01-13 04:28

I\'m using the WinPcap libraries and have set up all my native method calls. Upon building I get the CA2101: Specify marshaling for P/Invoke string arguments Code Analysis

相关标签:
1条回答
  • 2021-01-13 04:51

    This warning occurs because truncating Unicode text to an ASCII string can cause security issues.

    If you cannot use Unicode strings, set BestFitMapping = false, ThrowOnUnmappableChar = true on the attribute to prevent this security issue. For more information, see the documentation.

    0 讨论(0)
提交回复
热议问题