We use a third party library to manipulate Pdf's. Our application runs as a Windows service and handles thousands of files every month. Once in a while someone uploads a malformed Pdf, which makes the library run amok and eventually throw a StackOverflowException.
The library manufacturer has not fixed the error over the last 2 years, and we can't have our production crash when someone feels like it.
Automatically restarting the service does not seem like an option, as the application would then retry the malformed file. Since we process many files in parallel, we cannot know which is the malformed when starting.
Since stackoverflows can't be catched by default, I would like to know if I can tweak the CLR of the service to catch the exception anyway.