We have a very complex interaction problem in which the thread used to initialize a third-party system must be the same thread that was used to complete it. Failure to do so will result in deadlock. We interact with the WCF service hosted in IIS. Currently, this cleaning is available and, as a rule, works very well. Unfortunately, under heavy load, IIS will do a rough offload and we will never get a dispose call. We can move the shutdown logic to a critical finalizer, but that does not help, since we no longer have access to the initializing topic! For now, our only resource seems to notify the CLR that AppDomain is now probably in a damaged state. However, I am not sure how to do this (or if possible). Maybe this is the usefulness of contracts at the class level, but I admit that I do not quite understand them completely.
EDIT: As an alternative, this can be seen as a thread merge problem in the finalizer. If anyone has a smart solution, I'm all ears :)
source share