Strange problem with ClientContext

Strange problem with ClientContext

Old forum URL:

alexsychev posted on Monday, March 08, 2010


I'm working on Point of Sale application. We're using CSLA 3.6 in client/server mode, the server is hosted inside windows service.

I came across the following problem: sometimes during server side processing  I have the data from another request in ClientContext. Also the ApplicationContext.User contains wrong user.

It is difficult to reproduce and I'm not sure what triggers it. I looked a bit in the csla implementation of client context and it seems to be quite ok, because on server side the data is set before request processed and stored in per-thread storage (correct me if I'm wrong).

I have a feeling that it is not the CSLA which is the cause of the problem, but anyway: had anybody experience issues like this?


RockfordLhotka replied on Monday, March 08, 2010

Yes, in a Windows service host the values would be stored in TLS, and of course the principal is set as the thread's CurrentPrincipal.

Do you have any server-side multithreading going on? The data portal only sets the context values on the thread that is handling the request, and if you use any other threads you are responsible for setting the values on those threads

alexsychev replied on Sunday, March 14, 2010

OKay, it was purely and entirely the problem of my application. The wrong data came from another request. CSLA works correctly!

Copyright (c) Marimer LLC