public void WriteCore(string message)
{
// really huge messages mess up both VS and dbmon, so we chop it up into
// reasonable chunks if it's too big. This is the number of characters
// that OutputDebugstring chunks at.
const int WriteChunkLength = 4091;
// We don't want output from multiple threads to be interleaved.
lock (s_ForLock)
{
if (message == null || message.Length <= WriteChunkLength)
{
WriteToDebugger(message);
}
else
{
int offset;
for (offset = 0; offset < message.Length - WriteChunkLength; offset += WriteChunkLength)
{
WriteToDebugger(message.Substring(offset, WriteChunkLength));
}
WriteToDebugger(message.Substring(offset));
}
}
}