Hey I am having an issue with an application that I have created. Basically for the first few weeks I am trying to step in to catch all first chance exceptions. This is fine but it is causing multiple instances of word to open and is causing my system to crash from out of memory. So my question is does anyone have an idea on how to best implement this or any suggestions on how to fix this?
And the code is pretty simple.
AppDomain currentDomain = AppDomain.CurrentDomain;
currentDomain.FirstChanceException += LogException;
public async Task LogException(string exception)
{
var word = new Microsoft.Office.Interop.Word.Application();
var winVer = Environment.OSVersion.ToString();
CiteRightException exceptionData = new CiteRightException();
exceptionData.stackTrace = exception;
exceptionData.windowsVersion = word.Version;
exceptionData.windowsVersion = winVer;
var content = new StringContent(Json.Encode(exceptionData),
Encoding.UTF8, "application/json");
await httpClient.PostAsync("/api/logException", content);
}