Skip to content

Issue: Implicitly conversion from a non-nullable value type to the nullable form of that value type is broken? #188

@yyjdelete

Description

@yyjdelete

See https://github.com/StefH/System.Linq.Dynamic.Core/wiki/Dynamic-Expressions#conversions
Or I misused this in an not proper way?

Hit this issue with debug an query issue with efcore when eval at local, and it's able to write an reproduct case without efcore. Tested with 1.0.8.11

        public class ConsumptionWithDateLite
        {
            public DayOfWeek? DayOfWeek { get; set; }
        }

                var a1 = Enumerable.Repeat(0, 100)
                    .Select((d, i) => new DateTime(2000, 1, 1).AddDays(i))
                    .AsQueryable()
                    //.Select("new (DayOfWeek)")
                    .Select<ConsumptionWithDateLite>("new (DayOfWeek)");

                var z1 = a1.ToList();
                System.Diagnostics.Debug.Assert(!z1.Any(zx => zx.DayOfWeek == null));

Update: This get null on netcoreapp, and an System.Security.VerificationException:“操作可能会破坏运行时稳定性。”(Operation may break runtime stability) on netfx

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions