-
-
Notifications
You must be signed in to change notification settings - Fork 390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Note: Thread.CurrentPrincipal not flowing for async operations on Mono #806
Comments
In most environments CSLA doesn't manage the current identity, allowing the underlying platform to handle the identity on our behalf. The exceptions are WPF and Windows Forms, where the underlying platform doesn't handle the current identity in a way that makes any sense, so we maintain the current identity (from a CSLA perspective) in a CSLA also adapts to running in ASP.NET and uses HttpContext instead of the current thread, because those don't always match in the web server scenario, and only HttpContext is reliable. The A workaround we could consider for Android, is to have a custom CSLA app context provider, like the ones for WPF/WinForms, that maintains the current identity in a |
I did not know that. Thank you, I will take a look.
Sounds good, an |
This has now been fixed in the next release of mono: mono/mono#6326 (comment) |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I discovered a problem with Mono recently, when running on Android, if you set
Thread.CurrentPrincipal
, and then perform some async operation (i.e Task.Run()) - the principal won't flow to the new thread. If the async operation happens to execute fully on the same thread, obviously you get away with it, but if it runs on a new thread, Thread.CurrentPrincipal is lost. I created an issue at mono repo and it looks like there may be a fix in progress - but thought I would mention it here in case this impacts CSLA authentication code on Android devices. Interestingly if you use Task.Factory.StartNew - with theLongRunning
option, then it does flow.The fact this hasn't worked for so long on Mono makes me think that Thread.CurrentPrincipal (and in fact Principal's in general) is simply not used at all by Xamarin Android developers..
The text was updated successfully, but these errors were encountered: