Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatibility with Fody NullGuard #145

Open
space-alien opened this issue Mar 19, 2019 · 1 comment
Open

Incompatibility with Fody NullGuard #145

space-alien opened this issue Mar 19, 2019 · 1 comment

Comments

@space-alien
Copy link

space-alien commented Mar 19, 2019

When using Fody NullGuard, the following projection fails:

dbContext.People
    .Select(p => new
    {
        // Address is a related entity, Label is [Computed]
        AddressLabel = p.Address.Label,
    })
    .Decompile()
    .ToList();

With the error

Unhandled Exception: System.ArgumentException: Argument types do not match
   at System.Linq.Expressions.Expression.Condition(Expression test, Expression ifTrue, Expression ifFalse)
   at DelegateDecompiler.Address.Merge(Expression test, Address address1, Address address2, IDictionary`2 map)
   at DelegateDecompiler.Processor.ProcessorState.Merge(Expression test, ProcessorState leftState, ProcessorState rightState)
   at DelegateDecompiler.Processor.<>c__DisplayClass13_0.<ConditionalBranch>b__0()
   at DelegateDecompiler.Processor.Process()
   at DelegateDecompiler.Processor.Process(VariableInfo[] locals, IList`1 args, Instruction instruction, Type returnType)
   at DelegateDecompiler.MethodBodyDecompiler.DecompileConcrete(MethodInfo method, IList`1 args)
   at DelegateDecompiler.MethodBodyDecompiler.Decompile(MethodInfo method, Type declaringType)
   at DelegateDecompiler.DecompileExtensions.<>c__DisplayClass6_0.<.cctor>b__1()
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at DelegateDecompiler.DecompileExtensions.Decompile(MethodInfo method, Type declaringType)
   at DelegateDecompiler.DecompileExpressionVisitor.Decompile(MethodInfo method, Expression instance, IList`1 arguments)
   at DelegateDecompiler.DecompileExpressionVisitor.VisitMember(MemberExpression node)
   at System.Linq.Expressions.MemberExpression.Accept(ExpressionVisitor visitor)
   at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
   at System.Dynamic.Utils.ExpressionVisitorUtils.VisitArguments(ExpressionVisitor visitor, IArgumentProvider nodes)
   at System.Linq.Expressions.ExpressionVisitor.VisitNew(NewExpression node)
   at System.Linq.Expressions.NewExpression.Accept(ExpressionVisitor visitor)
   at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
   at System.Linq.Expressions.ExpressionVisitor.VisitLambda[T](Expression`1 node)
   at System.Linq.Expressions.Expression`1.Accept(ExpressionVisitor visitor)
   at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
   at System.Linq.Expressions.ExpressionVisitor.VisitUnary(UnaryExpression node)
   at System.Linq.Expressions.UnaryExpression.Accept(ExpressionVisitor visitor)
   at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
   at System.Dynamic.Utils.ExpressionVisitorUtils.VisitArguments(ExpressionVisitor visitor, IArgumentProvider nodes)
   at System.Linq.Expressions.ExpressionVisitor.VisitMethodCall(MethodCallExpression node)
   at DelegateDecompiler.DecompileExpressionVisitor.VisitMethodCall(MethodCallExpression node)
   at System.Linq.Expressions.MethodCallExpression.Accept(ExpressionVisitor visitor)
   at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
   at DelegateDecompiler.DecompileExpressionVisitor.Decompile(Expression expression)
   at DelegateDecompiler.DecompiledQueryProvider.CreateQuery[TElement](Expression expression)
   at DelegateDecompiler.DecompileExtensions.Decompile[T](IQueryable`1 self)
@hazzik
Copy link
Owner

hazzik commented Oct 17, 2022

/insert jiggle-jiggle meme.

Sorry, it was a long time, but could you please post here what resulting assembly after NullGuard? You can view it with il-spy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants