AntoineGa / Seq.App.Teams

Seq application for Microsoft Teams
MIT License
13 stars 10 forks source link

System.ObjectDisposedException: Cannot access a disposed object #23

Closed MattMofDoom closed 2 years ago

MattMofDoom commented 2 years ago

Hi @AntoineGa @nblumhardt ,

After the changes in #19, v2.0.37 throws a System.ObjectDisposedException.

I've reverted to v2.0.0 and haven't looked too deeply,, but it looks like _httpClientHandler is somehow being disposed, possibly after the first successful post.

Export of the error attached for your convenience, with the webhook attributes masked.

{"@t":"2021-10-17T16:19:32.8010714Z","@mt":"An error occured while constructing the request","@m":"An error occured while constructing the request","@i":"f179404c","@l":"Error","@x":"System.ObjectDisposedException: Cannot access a disposed object.\r\nObject name: 'SocketsHttpHandler'.\r\n at System.Net.Http.SocketsHttpHandler.CheckDisposed()\r\n at System.Net.Http.SocketsHttpHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n at System.Net.Http.HttpClientHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n at System.Net.Http.HttpMessageInvoker.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n at System.Net.Http.HttpClient.SendAsyncCore(HttpRequestMessage request, HttpCompletionOption completionOption, Boolean async, Boolean emitTelemetryStartStop, CancellationToken cancellationToken)\r\n at Seq.App.Teams.TeamsApp.OnAsync(Event1 evt) in C:\projects\seq-app-teams\Seq.App.Teams\TeamsApp.cs:line 156","Uri":"https://xxxx.webhook.office.com/webhookb2/yyyy/IncomingWebhook/zzzz","AppId":"hostedapp-303","AppInstanceId":"appinstance-586"}`

nblumhardt commented 2 years ago

Sorry, I introduced this one when lifting HttpClientHandler construction into OnAttached(). #24 should sort this out 😓

AntoineGa commented 2 years ago

the fix is on 2.0.38