hazzik / DelegateDecompiler

A library which is able to decompile a delegate or a method body to its lambda representation
MIT License
526 stars 62 forks source link

Comparison of enum with nullable enum fails #98

Closed tl24 closed 7 years ago

tl24 commented 7 years ago

Let's say I have these classes:

public enum MyEnum { One, Two }

public class MyModel { public MyEnum? EnumProp {get; set;} [Computed] public bool IsTwo => EnumProp == MyEnum.Two }

If I try and execute the query after decompiling I get this error: LINQ to Entities does not recognize the method 'MyEnum GetValueOrDefault()' method, and this method cannot be translated into a store expression

For some reason it is adding a GetValueOrDefault() call on to EnumProp from within IsTwo

hazzik commented 7 years ago

Released as 0.23.0