mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 22:30:41 +01:00
Can not unsubscribe from LogEntriesChanged event. #478
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @IamHF on GitHub (Jan 4, 2023).
Originally assigned to: @StefH on GitHub.
Describe the bug
Cannot unsubscribe from "LogEntriesChanged" event handler because a new delegate is created inside the add method of the event.
Expected behavior:
You should be able to unsubscribe from "LogEntriesChanged" with the same event handler that is used to subscribe to the event.
Test to reproduce
``
Other related info
public event NotifyCollectionChangedEventHandler LogEntriesChanged { add { _options.LogEntries.CollectionChanged += (sender, eventRecordArgs) => { try { value(sender, eventRecordArgs); } catch (Exception exception) { _options.Logger.Error("Error calling the LogEntriesChanged event handler: {0}", exception.Message); } }; } remove => _options.LogEntries.CollectionChanged -= value; }https://github.com/WireMock-Net/WireMock.Net/blob/master/src/WireMock.Net/Server/WireMockServer.LogEntries.cs
@StefH commented on GitHub (Jan 6, 2023):
@IamHF
Can you try preview version:
1.5.13-ci-16909https://github.com/WireMock-Net/WireMock.Net/wiki/MyGet-preview-versions
@StefH commented on GitHub (Jan 6, 2023):
https://github.com/WireMock-Net/WireMock.Net/issues/870
@StefH commented on GitHub (Jan 11, 2023):
@IamHF Can you please test that preview version?
@StefH commented on GitHub (Jan 15, 2023):
@IamHF
Can you please verify if that preview NuGet fixes your problem?
@StefH commented on GitHub (Jan 19, 2023):
Code merged