I'm trying to develop a dll project in C# which has to be able to catch all unhandled exceptions of the project that references it.
The idea is include this dll in any type of project (mvc, web api, other dll projects) and catch and log in a DB the exceptions with their entire call stacks to be able to reproduce them.
The problem is that I cannot use the currentDomain.UnhandledException += new UnhandledExceptionEventHandler(MyHandler);
because I'm in a dll project and there is not main method.
In the other hand, how can I register this dll in the projects to be able to catch their errors? Is it necessary to register something in the config file?