DO version 4.5.0.8751

public abstract class StaMachineInfo : Entity
{
protected StaMachineInfo(Session session)
    : base(session)
{
    Updated = DateTime.UtcNow;
}

protected StaMachineInfo(Session session, long id)
    : base(session, id)
{
    Updated = DateTime.UtcNow;
}

[Field]
public string MachineName { get; set; }

[Field(Indexed = true)]
public DateTime Updated { get; set; }

}

[HierarchyRoot]
public class StaSearchTermOperationCounter : StaMachineInfo
{
public StaSearchTermOperationCounter(Session session)
    : base(session)
{
}

public StaSearchTermOperationCounter(Session session, long searchTerm,        OperationType operationType, long operationSuccessCount, long operationFailedCount)
    : base(session)
{
    SearchTermId = searchTerm;
    OperationType = operationType;
    OperationSuccessCount = operationSuccessCount;
    OperationFailedCount = operationFailedCount;
}

[Field(Nullable = false)]
public long SearchTermId { get; internal set; }

[Field]
public OperationType OperationType { get; internal set; }

[Field]
public long OperationSuccessCount { get; internal set; }

[Field]
public long OperationFailedCount { get; internal set; }
}

Code fragment:
  using (var session = DB.OpenSession())
    using (session.OpenTransaction(IsolationLevel.Snapshot))
    {
        var now = DateTime.UtcNow;
        var startDate = new DateTime(now.Year, now.Month, 1);
        return session.Query.All<StaSearchTermOperationCounter>()
            .Where(ai => ai.Updated > startDate)
            .GroupBy(ai => ai.OperationType)
            .Select(i =>
                new OperationInfo
                {
                    OperationType = i.Key,
                    OperationSuccessCount = i.Sum(ai => ai.OperationSuccessCount),
                    OperationFailedCount = i.Sum(ai => ai.OperationFailedCount)
                })
             .ToArray();
    }

See inner exception for details. ---> System.NullReferenceException: Ссылка на объект     не указывает на экземпляр объекта.
в Xtensive.Orm.Linq.Translator.VisitNewExpressionArguments(NewExpression n)
в Xtensive.Orm.Linq.Translator.VisitMemberInit(MemberInitExpression mi)
в Xtensive.Linq.ExpressionVisitor`1.Visit(Expression e)
в Xtensive.Orm.Linq.Translator.Visit(Expression e)
в Xtensive.Orm.Linq.Translator.VisitLambda(LambdaExpression le)
в Xtensive.Orm.Linq.Translator.BuildProjection(LambdaExpression le)
в Xtensive.Orm.Linq.Translator.VisitSelect(Expression expression, LambdaExpression    le)
в Xtensive.Orm.Linq.Translator.VisitQueryableMethod(MethodCallExpression mc, QueryableMethodKind methodKind)
в Xtensive.Linq.QueryableVisitor.VisitMethodCall(MethodCallExpression mc)
в Xtensive.Orm.Linq.Translator.VisitMethodCall(MethodCallExpression mc)
в Xtensive.Linq.ExpressionVisitor`1.Visit(Expression e)
в Xtensive.Orm.Linq.Translator.Visit(Expression e)
в Xtensive.Orm.Linq.Translator.Translate()
в Xtensive.Orm.Linq.QueryProvider.Translate(Expression expression, CompilerConfiguration compilerConfiguration)
--- End of inner exception stack trace ---
в Xtensive.Orm.Linq.QueryProvider.Translate(Expression expression, CompilerConfiguration compilerConfiguration)
в Xtensive.Orm.Linq.QueryProvider.Translate(Expression expression)
в Xtensive.Orm.Linq.QueryProvider.Execute(Expression expression)
в Xtensive.Orm.Linq.Queryable`1.GetEnumerator()
в System.Linq.Buffer`1..ctor(IEnumerable`1 source)
в System.Linq.Enumerable.ToArray(IEnumerable`1 source)

asked Apr 26 '12 at 04:35

mmx003's gravatar image

mmx003
5112

edited Apr 27 '12 at 08:47

Could you please add part of your persistent model that is used in query. Also it would be useful to indent code parts with 4 spaces. This adds syntax highlighting and mono-spaced font.

(Apr 26 '12 at 09:23) Denis Krjuchkov Denis%20Krjuchkov's gravatar image

Thanks for updating your report. Unfortunately I still can not reproduce the problem. If you can make a test project, please send it to me via e-mail: support at dataobjects net

(May 04 '12 at 05:27) Denis Krjuchkov Denis%20Krjuchkov's gravatar image

I found bug. if OperationInfo is struct then i get exception, if OperationInfo is class then all work fine. Thanks.

(May 04 '12 at 06:15) mmx003 mmx003's gravatar image

Thanks for tracking the problem. To be fixed.

(May 04 '12 at 07:02) Denis Krjuchkov Denis%20Krjuchkov's gravatar image

One Answer:

Bug is fixed. Fix will be included in DataObjects.Net 4.5.1

answered May 04 '12 at 07:28

Denis%20Krjuchkov's gravatar image

Denis Krjuchkov
179325

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

Subscription:

Once you sign in you will be able to subscribe for any updates here

Tags:

×57

Asked: Apr 26 '12 at 04:35

Seen: 1,654 times

Last updated: May 04 '12 at 07:28

powered by OSQA