Skip to content

Instantly share code, notes, and snippets.

@EgorBo
Created June 23, 2019 15:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EgorBo/58e5a3a9e841d362cc41e21e75ecae58 to your computer and use it in GitHub Desktop.
Save EgorBo/58e5a3a9e841d362cc41e21e75ecae58 to your computer and use it in GitHub Desktop.
sb-marshalling-repro.cs
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace ConsoleApp162
{
class Program
{
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
static extern uint CharLowerBuffW([In, Out] StringBuilder lpsz, uint cchLength);
static void Main()
{
var sb = new StringBuilder().AppendLine("HELLO").AppendLine("WORLD").AppendLine("FROM MONO");
CharLowerBuffW(sb, (uint)sb.Length);
Console.WriteLine(sb);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment