
## Review A dedicated reviewer checked the rule description successfully for: - [ ] logical errors and incorrect information - [ ] information gaps and missing content - [ ] text style and tone - [ ] PR summary and labels follow [the guidelines](https://github.com/SonarSource/rspec/#to-modify-an-existing-rule)
8 lines
669 B
Plaintext
8 lines
669 B
Plaintext
== Why is this an issue?
|
|
|
|
When calling the `BeginInvoke` method of a https://learn.microsoft.com/en-us/dotnet/api/system.delegate[delegate], resources are allocated that are only freed up when `EndInvoke` is called. Failing to pair `BeginInvoke` with `EndInvoke` can lead to https://en.wikipedia.org/wiki/Resource_leak[resource leaks] and incomplete asynchronous calls.
|
|
|
|
This rule raises an issue in the following scenarios:
|
|
|
|
* The `BeginInvoke` method is called without any callback, and it is not paired with a call to `EndInvoke` in the same block.
|
|
* A callback with a single parameter of type `IAsyncResult` does not contain a call to `EndInvoke` in the same block. |