Skip to content

Language changes are breaking real-world use of dynamic #72750

@stephentoub

Description

@stephentoub

Version Used:
Version 17.10.0 Preview 3.0 [34721.271.main]

Steps to Reproduce:

using System.Text.Json;

public class C
{
    public static C M(IFoo foo, dynamic value)
    {
        var result = foo.Bar("name", value);
        return JsonSerializer.Deserialize<C>(result);
    }
}

public interface IFoo
{
    object Bar(string name, object value);
}

Expected Behavior:
Previously this compiled fine.
SharpLab

Actual Behavior:
Now it fails to compile:

error CS1503: Argument 1: cannot convert from 'object' to 'System.IO.Stream'

After the recent changes around dynamic, the type of result is now object whereas previously it was dynamic.

[jcouv:] Relates to #71421

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions