C # multithreading because the code has been optimized or the local framework is located on the call stack, the expression value cannot be calculated,
Find an explanation on the Internet:
A stack is used to store variables and methods. It is "placed above the call stack". We can understand that there are no variables or methods in the stack to call. In fact, the program has ended, the stack is empty (the pointer is on the external -- of the original stack ).
Put it in my actual scenario: I opened an asynchronous method to process an event, and the main thread did not wait for this Asynchronous Method to end directly. In fact, the main thread is closed, asynchronous mode is still running. The result is that the memory is released. If the asynchronous mode cannot find the variable, an error is returned.
Triggering scenario: when multiple threads run a large amount of data or complicated computing logic, the execution time exceeds 20 minutes, and the thread is automatically reclaimed by IIS.
Solution: IIS-> application pool-> Find the application pool of the application, right-click, advanced settings-> change idle timeout (minutes) to 1740 (20 minutes by default)