Answer the question
In order to leave comments, you need to log in
How to catch an exception from unmanaged code?
Hello. I wrote a program based on a third-party dll library (specifically, Telegram.Bot.dll). Instead of WebHook, I use Bot.OnUpdate, which constantly polls the server. Everything works fine, but every couple of days the program crashes, displaying the standard CLR. The error refers to System.Web.HttpRequest.dll. Maybe the server did not respond temporarily, or something else happened, I don’t know which exceptions in the library are not handled. The question is how to catch an exception from unmanaged code? I can't edit the dll in any way. Theories I've read a lot - everyone recommends using an external exception, but how to use it? It is the code, where to connect it, what needs to be written so that the program does not crash, but, for example, stupidly ignores and continues to work.
Answer the question
In order to leave comments, you need to log in
https://docs.microsoft.com/ru-ru/dotnet/api/system... You
can catch it using a regular try-catch
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question