title: .NET 3.5 JIT not working when running the application
body: <p>The following code gives different output when running the release inside Visual Studio, and running the release outside Visual Studio. I'm using Visual Studio 2008 and targeting .NET 3.5. I've also tried .NET 3.5 SP1.</p>
  
  <p>When running outside Visual Studio, the JIT should kick in. Either (a) there's something subtle going on with C# that I'm missing or (b) the JIT is actually in error. I'm doubtful that the JIT can go wrong, but I'm running out of other possiblities...</p>
  
  <p>Output when running inside Visual Studio:</p>
  
  <pre><code>    0 0,
      0 1,
      1 0,
      1 1,
  </code></pre>
  
  <p>Output when running release outside of Visual Studio:</p>
  
  <pre><code>    0 2,
      0 2,
      1 2,
      1 2,
  </code></pre>
  
  <p>What is the reason?</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  
  namespace Test
  {
      struct IntVec
      {
          public int x;
          public int y;
      }
  
      interface IDoSomething
      {
          void Do(IntVec o);
      }
  
      class DoSomething : IDoSomething
      {
          public void Do(IntVec o)
          {
              Console.WriteLine(o.x.ToString() + " " + o.y.ToString()+",");
          }
      }
  
      class Program
      {
          static void Test(IDoSomething oDoesSomething)
          {
              IntVec oVec = new IntVec();
              for (oVec.x = 0; oVec.x &lt; 2; oVec.x++)
              {
                  for (oVec.y = 0; oVec.y &lt; 2; oVec.y++)
                  {
                      oDoesSomething.Do(oVec);
                  }
              }
          }
  
          static void Main(string[] args)
          {
              Test(new DoSomething());
              Console.ReadLine();
          }
      }
  }
  </code></pre>