DO 5.0.7 RC2

Sample

internal class Program
{
    private static void Main(string[] args)
    {
        var dc = new DomainConfiguration("sqlserver", "Data Source=.; Initial Catalog=DO40-Tests; Integrated Security=True;")
        {
            UpgradeMode = DomainUpgradeMode.Recreate
        };

        dc.Types.Register(typeof(Program).Assembly);

        var id = Guid.NewGuid();
        var id1 = Guid.NewGuid();

        using (var d = Domain.Build(dc))
        {
            using (var s = d.OpenSession())
            using (s.Activate())
            using (s.OpenTransaction())
            {
                s.Query.All<Ent>()
                    .Where(e => ((e.TestEntity as TestEntity2).Link as TestEntity3).Link.Id.In(new[] { id, id1 }))
                    .ToArray();
            }
        }
    }
}

[HierarchyRoot]
public class Ent : Entity
{
    [Field, Key]
    public Guid Id { get; set; }

    [Field(Nullable = false, NullableOnUpgrade = true)]
    public TestEntity TestEntity { get; set; }
}

[HierarchyRoot]
public class TestEntity : Entity
{
    [Field, Key]
    public Guid Id { get; set; }

    [Field(Nullable = false, NullableOnUpgrade = true)]
    public string Name { get; set; }
}

public class TestEntity2 : TestEntity
{
    [Field(Nullable = false)]
    public TestEntity Link { get; set; }
}

public class TestEntity3 : TestEntity
{
    [Field(Nullable = false)]
    public TestLink Link { get; set; }
}

public class TestLink : TestEntity
{
    [Field(Nullable = false)]
    public TestEntity Link { get; set; }
}

Exception

"Unable to translate 'Query.All().Where(e => ((e.TestEntity as TestEntity2).Link as TestEntity3).Link.Id.In(new Guid[] {\r\n  @.id,\r\n  @.id1\r\n}))' expression. See inner exception for details."

"Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index"

at System.ThrowHelper.ThrowArgumentOutOfRangeException()
at System.Collections.Generic.List`1.get_Item(Int32 index)
at Xtensive.Collections.ReadOnlyList`1.get_Item(Int32 index)
at Xtensive.Orm.Rse.Providers.JoinProvider.Initialize()
at Xtensive.Orm.Rse.Providers.JoinProvider..ctor(CompilableProvider left, CompilableProvider right, JoinType joinType, Pair`1[] equalIndexes)
at Xtensive.Orm.Rse.CompilableProviderExtensions.LeftJoin(CompilableProvider left, CompilableProvider right, Pair`1[] joinedColumnIndexes)
at Xtensive.Orm.Linq.Translator.VisitTypeAs(Expression source, Type targetType)
at Xtensive.Orm.Linq.Translator.VisitUnary(UnaryExpression u)
at Xtensive.Linq.ExpressionVisitor`1.Visit(Expression e)
at Xtensive.Orm.Linq.Translator.Visit(Expression e)
at Xtensive.Orm.Linq.Translator.VisitMemberAccess(MemberExpression ma)
at Xtensive.Linq.ExpressionVisitor`1.Visit(Expression e)
at Xtensive.Orm.Linq.Translator.Visit(Expression e)
at Xtensive.Orm.Linq.Translator.VisitMemberAccess(MemberExpression ma)
at Xtensive.Linq.ExpressionVisitor`1.Visit(Expression e)
at Xtensive.Orm.Linq.Translator.Visit(Expression e)
at Xtensive.Orm.Linq.Translator.VisitBinary(BinaryExpression binaryExpression)
at Xtensive.Linq.ExpressionVisitor`1.Visit(Expression e)
at Xtensive.Orm.Linq.Translator.Visit(Expression e)
at Xtensive.Orm.Linq.Translator.VisitLambda(LambdaExpression le)
at Xtensive.Orm.Linq.Translator.VisitExistsAsInclude(Expression source, LambdaExpression predicate, Boolean notExists)
at Xtensive.Orm.Linq.Translator.VisitExists(Expression source, LambdaExpression predicate, Boolean notExists)
at Xtensive.Orm.Linq.Translator.VisitContains(Expression source, Expression match, Boolean isRoot)
at Xtensive.Orm.Linq.Translator.VisitIn(MethodCallExpression mc)
at Xtensive.Orm.Linq.Translator.VisitMethodCall(MethodCallExpression mc)
at Xtensive.Linq.ExpressionVisitor`1.Visit(Expression e)
at Xtensive.Orm.Linq.Translator.Visit(Expression e)
at Xtensive.Orm.Linq.Translator.VisitLambda(LambdaExpression le)
at Xtensive.Orm.Linq.Translator.VisitWhere(Expression expression, LambdaExpression le)
at Xtensive.Orm.Linq.Translator.VisitQueryableMethod(MethodCallExpression mc, QueryableMethodKind methodKind)
at Xtensive.Linq.QueryableVisitor.VisitMethodCall(MethodCallExpression mc)
at Xtensive.Orm.Linq.Translator.VisitMethodCall(MethodCallExpression mc)
at Xtensive.Linq.ExpressionVisitor`1.Visit(Expression e)
at Xtensive.Orm.Linq.Translator.Visit(Expression e)
at Xtensive.Orm.Linq.Translator.Translate[TResult]()
at Xtensive.Orm.Linq.QueryProvider.Translate[TResult](Expression expression, CompilerConfiguration compilerConfiguration)

asked Dec 20 '15 at 01:55

Anton%20Guschin's gravatar image

Anton Guschin
73303035

edited Dec 21 '15 at 04:37


One Answer:

Hello Anton.

Thanks for the report, I'll investigate the case. Tell me, please, is the problem specific for 5.0.7 RC2 only?

answered Dec 21 '15 at 03:00

Alexey%20Kulakov's gravatar image

Alexey Kulakov
77225

I guess, no

In 5.0.6 same exception

(Dec 21 '15 at 03:49) Anton Guschin Anton%20Guschin's gravatar image

Thanks for answer

(Dec 21 '15 at 04:39) Alexey Kulakov Alexey%20Kulakov's gravatar image
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

powered by OSQA