Vlad Novgorodov
unread,Nov 2, 2011, 5:05:24 PM11/2/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ravendb
Hi,
I've found a problem in build 472. The first query in the example
below works fine, but the second one causes "InvalidCastException":
var good = _session.Query<TestView>().Select(x => new
{ x.TestField }).ToArray();
var error = _session.Query<TestView>().Select(x =>
x.TestField ).ToArray();
The problem only occurs if type of "TestField" is Guid. Below is the
exception stack trace:
System.InvalidCastException: Invalid cast from 'System.String' to
'System.Guid'.
at System.Convert.DefaultToType(IConvertible value, Type
targetType, IFormatProvider provider)
at System.String.System.IConvertible.ToType(Type type,
IFormatProvider provider)
at System.Convert.ChangeType(Object value, Type conversionType,
IFormatProvider provider)
at Raven.Json.Linq.Extensions.Convert[U](RavenJToken token, Boolean
cast)
at Raven.Json.Linq.Extensions.Convert[U](RavenJToken token)
at Raven.Json.Linq.RavenJObject.Value[T](String key)
at
Raven.Client.Document.SessionOperations.QueryOperation.DeserializedResult[T]
(RavenJObject result)
at
Raven.Client.Document.SessionOperations.QueryOperation.Deserialize[T]
(RavenJObject result)
at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1
collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at
Raven.Client.Document.SessionOperations.QueryOperation.Complete[T]()
at Raven.Client.Document.AbstractDocumentQuery`2.GetEnumerator()
at Raven.Client.Linq.RavenQueryInspector`1.GetEnumerator()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
.....