I wrote a procedure that is executed in a separate AppDomain. This procedure read, recursively, all properties of every file contained in the main Assembly. When an assembly is very "big" this procedure take several times and after 10-12 minutes it returns the error: "Object "/AAAAA.rem" has been disconnected or does not exist at the Server". In this class, that runs in a separate AppDomain, I overrided the LifeTimeManager method in this way:
public override object InitializeLifetimeService()
but still gives me this error. What can I do to avoid this?
Thnaks in advance.
The first question that I would answer is do you get the same result when not executing in a separate AppDomain. My suspicion is that the exception will occur with your current code in a default AppDomain.
If that's not the case, then something you can try is my SolidEdge.Community NuGet package. It has a custom built IsolatedTask<T> class that I wrote to handle this very scenario. You can either install the NuGet package and give it a try as-is or take a look at the source code to see how I implemented it. To my knowledge, that class has never had the issue that you describe. An example of how to use my IsolatedTask<T> would be my BatchPrint sample.
Thanks for your replay (as always).
I tried to run the method in the default AppDomain and everything was fine (the procedure take about 48 minutes).
So, the problem is Class Lifetime that run on second appDomain.
Can you please explain how I should to use IsolatedTask<T> in my case?
I used IsolatedTask class but the problem persists. When i execute all in the default AppDomain all goes fine, when i start the second app domain the procedure after 10 12 minutes returns the error. Can you help me?