0
1

Version : 4.3.5 build 6242

Query:

      var query = Query.All<MyEntity>()
        .Select(e => new 
          {
            MyEntity = e,
            Year = (int?)e.Date.Value.Year,
            Status = e.Infos.OfType<SuccessInfo>().Any() ? Status.Success : (e.Infos.OfType<ErrorInfo>().Any() ? Status.Error : Status.Unknown)
          })
        .Select(o => new object[] { o.MyEntity.Id, o.Year, o.Status });

Exception:

System.InvalidCastException was unhandled
  Message=Specified cast is not valid.
  Source=Xtensive.Core
  StackTrace:
       at Xtensive.Core.Tuples.Tuple.GetValueOrDefaultInternal[T](Boolean isNullable, Int32 fieldIndex)
       at Xtensive.Core.Tuples.Tuple.GetValueOrDefault[T](Int32 fieldIndex)
       at lambda_method(Closure , Object[] , Tuple , ItemMaterializationContext )
       at Xtensive.Core.DelegateBindExtensions.<>c__DisplayClassa`4.<Bind>b__9(T2 arg2, T3 arg3)
       at Xtensive.Storage.Linq.Materialization.MaterializationHelper.<>c__DisplayClass4`1.<Materialize>b__3(Tuple tuple)
       at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
       at Xtensive.Core.EnumerableExtensions.<Batch>d__20`1.MoveNext()
       at Xtensive.Core.EnumerableExtensions.<ApplyBeforeAndAfter>d__28`1.MoveNext()
       at Xtensive.Storage.TransactionalExtensions.<ToTransactional>d__0`1.MoveNext()
       at System.Linq.Enumerable.<SelectManyIterator>d__14`2.MoveNext()
       at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
       at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)

Test project :

http://olorin.dinauz.org/temp/TestMaterializationBug.zip

The really strange thing is that the same query works if I change the order of selected columns...

asked Oct 05 '10 at 12:40

olorin's gravatar image

olorin
358848792

edited Oct 08 '10 at 06:22

Alex%20Yakunin's gravatar image

Alex Yakunin
29714412

PS: is there a function to upload files? that would be practical for those who don't have a webserver handy.

(Oct 05 '10 at 12:41) olorin olorin's gravatar image

Unfortunately, there is no such function (we depend on OSQA in this case). But sending us a sample via e-mail is ok.

(Oct 05 '10 at 14:25) Alex Yakunin Alex%20Yakunin's gravatar image

Concerning the issue: definitely a bug. We got a very similar report from one of our own teams today, so likely, we introduced some new issue related to materialization of anonymous type in one of the latest updates.

(Oct 05 '10 at 14:27) Alex Yakunin Alex%20Yakunin's gravatar image

One Answer:

Issue 825 is created.

UPDATE: Actual issue number is 828

answered Oct 08 '10 at 03:21

Alex%20Yakunin's gravatar image

Alex Yakunin
29714412

edited Oct 12 '10 at 04:36

Dmitri%20Maximov's gravatar image

Dmitri Maximov
22111211

This issue is marked as can't reproduce : won't fix in your tracker. Does it mean it is fixed in latest version? What it is the minimal build number with the fix? You can definitely reproduce it with my project sample.

(Oct 12 '10 at 04:20) olorin olorin's gravatar image

Hello,

The actual issue number is 828 and it is in work.

Sorry for the inconvenience.

(Oct 12 '10 at 04:32) Dmitri Maximov Dmitri%20Maximov's gravatar image

Ok, no problem!

(Oct 12 '10 at 10:12) olorin olorin's gravatar image

Any update on this? If this is fixed what is the starting build number with the fix?

(Oct 19 '10 at 06:05) olorin olorin's gravatar image

It is reported as fixed, and the installers on our website (build #6420) already contain this fix.

I'd appreciate if you try this build and report whether the issue is resolved.

(Oct 19 '10 at 09:29) Dmitri Maximov Dmitri%20Maximov's gravatar image

Works for me :)

(Oct 22 '10 at 05:17) olorin olorin'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