dotnet / try

Try .NET provides developers and content authors with tools to create interactive experiences.
MIT License
2.89k stars 523 forks source link

Declaring a `dynamic` variable results in no new output #315

Open BillWagner opened 5 years ago

BillWagner commented 5 years ago

Describe the bug

Start with the following program at https://try.dot.net:

using System;

public class Program
{
  public static void Main()
  {
    Console.WriteLine(DateTime.Now);
    object obj = 1;
    Console.WriteLine(obj.GetType());
    Console.WriteLine(obj);
  }
}

That works fine. Now, make the following change to the line where obj is declared:

    dynamic obj = "hi";

Click the "Run" button again. The displayed output does not change. You'll still see the type as System.Int32, the value as 1, and the previous timestamp.

Did this error occur while using dotnet try or online?

What kind of error was it?

Screenshots

If applicable, add screenshots to help explain your problem.

Please complete the following:

LadyNaggaga commented 5 years ago

Adding @rchande , @jonsequitur @colombod

rchande commented 5 years ago

@BillWagner Thanks for filing. This appears to be a specific issue with dynamic--we'll follow up with mono team.