Fix to not pass StringBuilder
by reference (out
or ref
) in P/Invoke (#9066)
Don't pass StringBuilder by reference (using out or ref). Otherwise, the CLR will expect the signature of this argument to be wchar_t ** instead of wchar_t *, and it won't be able to pin StringBuilder's internal buffer. Performance will be significantly degraded.
This commit is contained in:
parent
78f4ba5ec1
commit
0f7efddd22
1 changed files with 2 additions and 2 deletions
|
@ -758,7 +758,7 @@ namespace Microsoft.PowerShell
|
|||
bool result =
|
||||
NativeMethods.ReadConsole(
|
||||
consoleHandle.DangerousGetHandle(),
|
||||
out buffer,
|
||||
buffer,
|
||||
(DWORD)charactersToRead,
|
||||
out charsReadUnused,
|
||||
ref control);
|
||||
|
@ -3022,7 +3022,7 @@ namespace Microsoft.PowerShell
|
|||
internal static extern bool ReadConsole
|
||||
(
|
||||
NakedWin32Handle consoleInput,
|
||||
out StringBuilder buffer,
|
||||
StringBuilder buffer,
|
||||
DWORD numberOfCharsToRead,
|
||||
out DWORD numberOfCharsRead,
|
||||
ref CONSOLE_READCONSOLE_CONTROL controlData
|
||||
|
|
Loading…
Reference in a new issue