dotnet/roslyn

Immediate/watch window not formatting DateTimes inside loops

オープン

#33,130 opened on 2019/02/05

 (0 件のコメント) (0 件のリアクション) (0 人の担当者)C# (4,257 件のフォーク)batch import
Area-InteractiveBugInteractive-Debugginghelp wanted

Repository metrics

Stars
 (20,414 個のスター)
PR merge metrics
 (平均マージ 6d 17h) (30d で 256 merged PRs)

説明

Version Used: Visual Studio 2019 Preview 2

🔗 Originally filed as https://devdiv.visualstudio.com/DevDiv/_workitems/edit/215428

Steps to Reproduce:

using System;
using System.Linq;

namespace ConsoleApp1
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var dt = new DateTime(2016, 3, 2);
            var result = Enumerable.Range(1, 1).Select(x => dt.ToString("yyyy")).First();
            Console.WriteLine(result);
        }
    }
}
  1. Set a breakpoint on the line with Console.WriteLine

  2. When the breakpoint is hit, observe the value of result

  3. In the Immediate window, run the following:

    Enumerable.Range(1, 1).Select(x => dt.ToString("yyyy")).First()
    

Expected Behavior:

Step (2) and (3) produce "2016".

Actual Behavior:

Step (2) produces "2016".

Step (3) produces "3/2/2016 12:00:00 AM".

コントリビューターガイド