I am maintaining a fax server Windows service written in C#. The service references a compiled external .NET library for imaging functions.
In several production environments, every few days, the imaging component starts to throw exceptions claiming that memory is corrupt, and after that it stops working altogether, crashing the service.
The component's developers are no help because this is an older version of the component which isn't supported, and currently I cannot upgrade. Also, this was tested in several production environments and occurs in all of them, so it is unlikely that this is really corrupted memory. From the steady increase in memory consumption I assume this is a memory leak on their part. Restarting the service always solves the problem.
I would like to unload the reference to the external component and re-load it after each call. I prefer this to restarting the service automatically on a schedule. However, I have tried to dynamically load the component using Assembly.LoadFrom and using reflection, but the component throws generalized meaningless exceptions whenever I invoke any methods.
Can anyone suggest how to do this?