dotnet / dotnet/winforms

Preserve callstack when using Control.BeginInvoke with MethodInvoker

Open
#14,083 3 comments 0 reactions 1 assignee Claimed by @KlausLoeffelmann View on GitHub
api-suggestion needs-area-label untriaged
Dominant language
C#
Stars
4.9k
Forks
1.1k
Avg merge
20h 23m
Merged PRs (30d)
103

Description

### Background and motivation

In an application we have the following code:
```vbnet
Private Sub MyControl_LookUpEdit_EditValueChanged(sender As Object, e As EventArgs) Handles MyControl_LookUpEdit.EditValueChanged
BeginInvoke(New MethodInvoker(AddressOf AfterMyControlChange))
End Sub
```

It is used to work around data binding issues where the binding source datasource isn't updated until after the EditValueChanged event (devexpress).

Occasionally we get exceptions. The call stack root is at the function level. So we don't see what triggered the function call.

It would be nice if we could preserve the callstack across the boundary allowing us to fully log it to track down issues.

### API Proposal

n/a

### API Usage

n/a

### Alternative Designs

_No response_

### Risks

_No response_

### Will this feature affect UI controls?

n/a

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.