开发者

Error after selecting object with Perst for Windows Phone

I have the following situation:

My WP7 app has a login screen, where it executes the following lines of code:

var userQuery = DataAccessManager.Instance.Database.Select<LocalUser>(u => _userLogin.Equals(u.Login));  //_userLogin and Login property are strings
var lstUser = userQuery.ToList();

In some situation, I need to call the login screen again, where it executes the same method with the same lines of code above. But, in this second time, I get the following error when calling

var lstUser = userQuery.ToList();

Mobiltec.Atheneum.Common.Utils.Synchronization.AuthHandler+<>c__DisplayClass2.userLogin at System.Reflection.RuntimeFieldInfo.GetValue(Object obj) at System.Linq.jvm.ExpressionInterpreter.b_0(FieldInfo field) at System.Linq.jvm.Extensions.OnFieldOrProperty(MemberInfo self, Action1 onfield, Action1 onprop) at System.Linq.jvm.ExpressionInterpreter.VisitMemberInfo(MemberInfo mi) at System.Linq.jvm.ExpressionInterpreter.VisitMemberAccess(MemberExpression member) at System.Linq.jvm.ExpressionVisitor.Visit(Expression expression) at System.Linq.jvm.ExpressionInterpreter.VisitMethodCall(MethodCallExpres开发者_如何学Csion call) at System.Linq.jvm.ExpressionVisitor.Visit(Expression expression) at System.Linq.jvm.ExpressionInterpreter.Interpret(LambdaExpression lambda, Object[] arguments) at System.Linq.jvm.Interpreter.Run(Object[] arg) at System.Linq.jvm.Interpreter.FuncRunner[T,TResult](LocalUser arg) at Perst.Database.LinqEnumerator1.MoveNext() at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) at Mobiltec.Atheneum.Common.Utils.Synchronization.AuthHandler.Authenticate(String _userLogin, String _password, String deviceNickname) at Mobiltec.Atheneum.Reader.WindowsPhone.Controls.LoginControl.<>c_DisplayClass4.b__0(Object state) at System.Threading.ThreadPool.WorkItem.doWork(Object o) at System.Threading.Timer.ring()

Any idea about it?. We have the same class in a Silverlight to Desktop application and I don't know why it's happening with WP7.

PS1: The problem doesn't occur with LocalUser class only...it's with any class.

PS2: If I use this:

var userQuery = DataAccessManager.Instance.Database.Select<LocalUser>(u => "cesarautor@atheneum.com".Equals(u.Login)); //as sample...any dumb string works

instead of

var userQuery = DataAccessManager.Instance.Database.Select<LocalUser>(u => _userLogin.Equals(u.Login));

it works...

Thanks in advance


I found a few other references around about Perst and FieldAccessException: e.g. http://forums.mcobject.com/index.php?showtopic=7916

At a guess, this will be caused by the code somehow using trying to use reflection on that expression - as this will works OK inside the less restrictive environment of the Silverlight desktop.

Does it work if you change the _userLogin reference to instead reference a local variable - as this would hopefully require less/different reflection calls

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜