Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not unsubscribe from LogEntriesChanged event. #870

Closed
IamHF opened this issue Jan 4, 2023 · 5 comments
Closed

Can not unsubscribe from LogEntriesChanged event. #870

IamHF opened this issue Jan 4, 2023 · 5 comments
Assignees
Labels

Comments

@IamHF
Copy link

IamHF commented Jan 4, 2023

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

@IamHF IamHF added the bug label Jan 4, 2023
@StefH StefH self-assigned this Jan 6, 2023
@StefH
Copy link
Collaborator

StefH commented Jan 6, 2023

@IamHF
Can you try preview version: 1.5.13-ci-16909

https://github.com/WireMock-Net/WireMock.Net/wiki/MyGet-preview-versions

@StefH
Copy link
Collaborator

StefH commented Jan 6, 2023

#870

@StefH
Copy link
Collaborator

StefH commented Jan 11, 2023

@IamHF Can you please test that preview version?

@StefH
Copy link
Collaborator

StefH commented Jan 15, 2023

@IamHF
Can you please verify if that preview NuGet fixes your problem?

@StefH
Copy link
Collaborator

StefH commented Jan 19, 2023

Code merged

@StefH StefH closed this as completed Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants