title: Escape characters in ETW format strings?
body: <p>I'm using the new EventSource class to write to the Windows Event log from my applications, and so far it's great. However, there are two things that I observe that are causing problems that are probably related: the format strings passed to the Event attribute don't appear to undergo normal string.Format processing before being written to the event log.</p>
  
  <p>Consider this block:</p>
  
  <pre><code>[Event((int)LogEvent.UserCreated, Keywords=Keywords.Directory, Channel=EventChannel.Operational,
  Message="Created username {0} with forum post signature {1} and homepage {2}.")]
  public void UserCreated(string username, string signature, string homepageAddress)
  {
      WriteEvent((int)LogEvent.UserCreated, username, signature, homepageAddress);
  }
  </code></pre>
  
  <p>A few things occur:</p>
  
  <ul>
  <li>If I try to insert a \n into the format string for the message, no newline is printed in the event log.</li>
  <li>If the signature string contains a newline, the newline is printed naturally in the event log.</li>
  <li>If the signature or homepageAddress strings contain ETW-like tokens (%1, %2, or %3), then ETW begins replacing those pseudo-tokens with the variables themselves, and I end up with variables nested within themselves.</li>
  </ul>
  
  <p>I assume that if there was an escape character for ETW, it could be used to put newlines in format strings, and would also allow me to pre-process my string values to protect against these sql-injection style bugs. </p>
  
  <p>Does such an escape character exist? How is this usually done?</p>