title: Setting property in Immediate Window not setting?
body: <p>I have a problem in a project where I put a break point and start working with the properties of an object, and I can't set a value to a nullable int.  I can set it to null, but if I set it to anything then immediately check the value, it returns 1.</p>
  
  <p>I'm seeing this in the immediate window as well as the inspection window that pops up when you hover over a object when paused in debug mode.  It also appears that this doesn't affect running code, just when you break and try to play with the values.  </p>
  
  <p>I was able to reproduce it in a new console project:</p>
  
  <pre><code>class Program
    {
      static void Main(string[] args)
      {
        var myValue = new TestItem()
        {
          NullableIntValue = null,
          StringValue = "My test value"
        };
  
        Console.WriteLine(string.Format("{0} is set to {1}", myValue.StringValue, myValue.NullableIntValue.HasValue ? myValue.NullableIntValue.Value.ToString() : "nothing"));
  
        myValue.NullableIntValue = 0;
  
        Console.WriteLine(string.Format("{0} is set to {1}", myValue.StringValue, myValue.NullableIntValue.Value));
  
        Console.ReadLine();
  
      }
    }
  
    public class TestItem
    {
      public int? NullableIntValue { get; set; }
      public string StringValue { get; set; }
    }
  </code></pre>
  
  <p>Paste that into a new console project, and put a break point at the "myValue.NullableIntValue = 0;" line.  Then run it.</p>
  
  <p>When the breakpoint hits, open the immediate window and set the value:</p>
  
  <pre><code>myValue.NullableIntValue = 123;
  123
  </code></pre>
  
  <p>Then check the value:</p>
  
  <pre><code>?myValue.NullableIntValue
  1
  </code></pre>
  
  <p>Try it with something else:</p>
  
  <pre><code>myValue.NullableIntValue = null
  null
  ?myValue.NullableIntValue
  null
  </code></pre>
  
  <p>Set it to anything other than null and it seems to always be 1.</p>
  
  <p>You can also hover over the breakpoint line "myValue" and let VS pop open the inspection window where you see all the values.  Go to NullableIntValue and set it to 100 (or anything) and hit enter and it immediately changes it to 1.</p>
  
  <p>This only seems to behave this way for a property, i.e. if I change TestItem.NullableIntValue to a variable instead of a property it works fine.  And if I assign a value to the NullableIntValue in code and let it run it seems to take it no problem, just not during a break in debug.</p>
  
  <p>Note, also tried this in VS 2013 and it takes the assignment just fine, so it seems limited to VS 2015, and I tried both C# 6 and C# 5, happens on both.</p>
  
  <p>Any ideas what could be causing this?</p>