Richard, thank you for your reply. Well, at least I'm glad that it's not just me ;) I searched extensively, and although I found some solutions for ASP.NET (specifically the one Stephen Cleary proposed), I didn't really find anything satisfying for WPF.
Initially, I went down the AppDomain route as well, but as you said yourself, my application must indeed have to capability of login off and in, so that's basically out of the question as an easy solution.
What I decided to try (and it works, although the 'proper' way of using the Thread.CurrentPrincipal would have been nice, after all it's made for it), was the following: I have a ObjectBase class, which I used as the baseclass for all my client-side entities. In that class I already have a public static CompositionContainer object, where I store all catalogs I need for dependency injection through MEF. I just included a public static ClaimsPrincipal object as well, and when I log in, I store the resulting ClaimsPrincipal that my authentication call returns in there. Upon loggin out, I simply clear that object. Seems to work just fine, as you'd expect.
So my login just looks like this now:
await WithClientAsync(servfact.GetServiceClient<iaccountservice>(), async proxy =>
{
ObjectBase.ClaimsPrincipal = await proxy.AuthenticateUserAsync(Login, Hasher.CalculateHash(password, Login));
});
After review, I will probably change my code real quick, and use your solution, as it separates out the issue much better. Again, thanks for this!
Just for completeness: I left out some non-relevant stuff from the code, such as the encryption for the password and all of that.
So, all in all, the problem is fixed, but I would still hope that a future release would remedy this. Any ideas on how .NET 4.6 behaves in this scenario?