New Posts New Posts RSS Feed: InvokeServerMethodAsync - threading problems?
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

InvokeServerMethodAsync - threading problems?

 Post Reply Post Reply
Author
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Topic: InvokeServerMethodAsync - threading problems?
    Posted: 13-Jun-2011 at 11:55am
Hi danjal;

Could you post some code snippets of your InvokeServerMethod logic on the client?
Back to Top
danjal View Drop Down
Groupie
Groupie


Joined: 20-Sep-2010
Posts: 43
Post Options Post Options   Quote danjal Quote  Post ReplyReply Direct Link To This Post Posted: 09-Jun-2011 at 9:59am

I have a datagrid that contains some data.

In this grid, there is an expand button. When the user clicks this button a nested grid appears, with data that belongs to the specific row.

The data for the nested grid come from a InvokeServerMethodAsync call that is called the first time the user hits this expand button. This works fine.

 

Then I added a refresh functionality to the grid, that when used, refetches the data for the master grid and calls InvokeServerMethodAsync for the nested grids. This is where I get an error, which I think has something to do with the fact that I am calling the same InvokeServerMethodAsync many times within a short time frame.

But why is this a problem?

We are using Silverlight DevForce 6.0.9

Message: System.InvalidOperationException: An EntityManager can only execute on a single thread. This EntityManager is authorized to execute on the thread with id=’1’; the requested operation came from the thread with Id=‘53’. Consider calling the EntityManager’s asynchronous methods; they work safely on background threads managed by DevForce.  You may have to disable this cross-thread checking for specific reasons such as automated testing. Please review our documentation on multi-threading issues and the EntityManager.AuthorizedThreadId property.

 
   at IdeaBlade.EntityModel.EntityQueriedEventArgs.get_Results()
   at IdeaBlade.EntityModel.EntityQueryOperation.get_Results()
   at IdeaBlade.EntityModel.ListEntityReference`1.QueryCallback(EntityQueryOperation op)
   at IdeaBlade.EntityModel.BaseOperation`2.OnCompleted()
   at IdeaBlade.EntityModel.BaseOperation`2.IdeaBlade.EntityModel.IHasAsyncEventArgs.OnCompleted()
   at IdeaBlade.EntityModel.AsyncProcessor`1.<>c__DisplayClass2.<.ctor>b__0(TArgs args)
   at IdeaBlade.EntityModel.AsyncProcessor`1.Signal()
   at IdeaBlade.EntityModel.AsyncProcessor`1.<CheckPreActionHasError>b__6(Object d)
   at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()   

 



Edited by danjal - 09-Jun-2011 at 10:02am
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down