1

The title of the question pretty much says it all. Will static variables marked with the [ThreadStaticAttribute] get messed up if you use ExecutionContext.SuppressFlow() to cancel the propagation of the security context and identity token, etc.?

In other words, are thread statics included in the set of context items? If so, is there a way to specify which parts of the context you want (i.e. only ThreadStatics and not the rest).

casperOne
  • 73,706
  • 19
  • 184
  • 253
Glenn Slayden
  • 17,543
  • 3
  • 114
  • 108
  • No. What makes you think that? – Hans Passant Oct 08 '11 at 00:33
  • Racking my brain about where I got this impression, I now remember that it was probably from Stephen Toub's excellent article http://msdn.microsoft.com/en-us/magazine/cc163644.aspx : "if nothing about the source thread is transferred to the target thread, the disconnect that occurs can lead to a variety of problems. Some of these problems lead to functional bugs, such as data stored in the source's thread-local storage not being available during execution..." – Glenn Slayden Oct 08 '11 at 01:23
  • p.s. I did realize that that says TLS and not ThreadStatic, but it raised the possibility that the latter also might not be flowed..? – Glenn Slayden Oct 08 '11 at 01:25
  • So... are ThreadStatic variables not TLS then? – Brain2000 Aug 05 '18 at 05:20
  • @Brain2000 Not sure. Unfortunately, the link to Toub's article is now dead and I can't seem to refresh my memory about this issue :-( – Glenn Slayden Aug 05 '18 at 10:41

0 Answers0