0

In my asp.net (4.7.2) application sometimes occur thread hop. I have used HttpContext.Current to deal with it. But some ago AsyncLocal come, but I find out it is null after thread hop. Is it right behavior or I should use f.e. net 4.8?

update

Thread hop have another name - thread agility. The fenomen is described f.e in post:

What is the meaning of thread-agility in ASP.Net?

Igor
  • 310
  • 1
  • 14
  • 1
    Please show a minimally reproducible example. Generally speaking AsyncLocal provides a means to make a value available within the current callstack, while supporting async/await. If your AsyncLocal is null that means the location where you access it is not in the downward callstack from the location where you set the value. – ckuri Dec 22 '22 at 17:07
  • Can you please give an example of the "thread hop"? – Guru Stron Dec 22 '22 at 20:56
  • The real question to you is that what exactly you wanted to save across threads. You do have other options to save such (like sessions). – Lex Li Jan 02 '23 at 07:22
  • I do not want to save data across threads, i want to be sure about data that tied with my "business operation realization flow". Should i care about AsyncLocal in "asp.net" will behave diffrent than AsyncLocal in "console application"? But i am not sure that asyncLocal is such a thing. – Igor Jan 03 '23 at 18:01

0 Answers0