Forum Xamarin Cross Platform with Xamarin

Should CurrentPrincipal carry across async+await method calls?

So I have this example code:


Basically, it runs "lemming" threads which repeatedly set up a custom Thread.CurrentPrincipal, await Task.Delay, and then check the principal after the await.

On windows, it runs fine with no problems found; each lemming thread's logical thread of execution keeps its principal just fine for minutes on end.

On mono on linux (and when I port the code into a simple xamarin iOS app), I get constant problems found, where the Thread.CurrentPrincipal is lost immediately after each await Task.Delay:


Is my expectation of CurrentPrincipal incorrect and the windows case is just working by happenstance? Or is this another xamarin/mono bug?

Tagged:

Answers

Sign In or Register to comment.