Skip to content

System.Data.SqlClient does not allow enum parameters values (it does in .NET) #14527

@mgravell

Description

@mgravell

Is this an expected break?

For example:

    using (var cmd = connection.CreateCommand())
    {
        cmd.CommandText = "select @foo";
        cmd.Parameters.AddWithValue("@foo", AnEnum.B);
        object value = cmd.ExecuteScalar();
        AnEnum val = (AnEnum)value; // cheeky unbox behavior
        val.IsEqualTo(AnEnum.B);
    }

    enum AnEnum
    {
        A = 2,
        B = 1
    }

In .NET this works fine; in CoreCLR this breaks on the ExecuteScalar() call, reporting an ArgumentException with text:

No mapping exists from object type AnEnum to a known managed provider native type.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions