title: String.Format exception when format string contains "{"
body: <p>I am using VSTS 2008 + C# + .Net 2.0. When executing the following statement, there is FormatException thrown from String.Format statement, any ideas what is wrong?</p>
  
  <p>Here is where to get the template.html I am using. I want to format this part m={0} in template.html.</p>
  
  <pre><code>    string template = String.Empty;
      using (StreamReader textFile = new StreamReader("template.html"))
      {
          template = textFile.ReadToEnd();
          String.Format(template, "video.wmv");
      }
  </code></pre>
  
  <p><a href="http://www.mediafire.com/download.php?u4myvhbmmzg" rel="noreferrer">http://www.mediafire.com/download.php?u4myvhbmmzg</a></p>
  
  <p>EDIT 1:</p>
  
  <p>Here is the content for my template.html,</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
  &lt;!-- saved from url=(0014)about:internet --&gt;
  &lt;head&gt;
      &lt;title&gt;Silverlight Project Test Page &lt;/title&gt;
  
      &lt;style type="text/css"&gt;
      html, body {
          height: 100%;
          overflow: auto;
      }
      body {
          padding: 0;
          margin: 0;
      }
      #silverlightControlHost {
          height: 100%;
      }
      &lt;/style&gt;
  
      &lt;script type="text/javascript"&gt;
          function onSilverlightError(sender, args) {
  
              var appSource = "";
              if (sender != null &amp;&amp; sender != 0) {
                  appSource = sender.getHost().Source;
              } 
              var errorType = args.ErrorType;
              var iErrorCode = args.ErrorCode;
  
              var errMsg = "Unhandled Error in Silverlight 2 Application " +  appSource + "\n" ;
  
              errMsg += "Code: "+ iErrorCode + "    \n";
              errMsg += "Category: " + errorType + "       \n";
              errMsg += "Message: " + args.ErrorMessage + "     \n";
  
              if (errorType == "ParserError")
              {
                  errMsg += "File: " + args.xamlFile + "     \n";
                  errMsg += "Line: " + args.lineNumber + "     \n";
                  errMsg += "Position: " + args.charPosition + "     \n";
              }
              else if (errorType == "RuntimeError")
              {           
                  if (args.lineNumber != 0)
                  {
                      errMsg += "Line: " + args.lineNumber + "     \n";
                      errMsg += "Position: " +  args.charPosition + "     \n";
                  }
                  errMsg += "MethodName: " + args.methodName + "     \n";
              }
  
              throw new Error(errMsg);
          }
      &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;!-- Runtime errors from Silverlight will be displayed here.
      This will contain debugging information and should be removed or hidden when debugging is completed --&gt;
      &lt;div id='errorLocation' style="font-size: small;color: Gray;"&gt;&lt;/div&gt;
  
      &lt;div id="silverlightControlHost"&gt;
          &lt;object data="data:application/x-silverlight," type="application/x-silverlight-2" width="500" height="240"&gt;
              &lt;param name="source" value="ClientBin/VideoPlayer.xap"/&gt;
              &lt;param name="onerror" value="onSilverlightError" /&gt;
              &lt;param name="background" value="white" /&gt;
              &lt;param name="initParams" value="cc=true,markers=true,m={0}" /&gt;
              &lt;a href="http://go.microsoft.com/fwlink/?LinkID=115261" style="text-decoration: none;"&gt;
                  &lt;img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"/&gt;
              &lt;/a&gt;
          &lt;/object&gt;
          &lt;iframe style='visibility:hidden;height:0;width:0;border:0px'&gt;&lt;/iframe&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>thanks in avdance,
  George</p>