Back to Devexpress

DXWIN0007: Invocation without Handle

windowsforms-403886-build-an-application-security-considerations-code-diagnostics-win-007-message.md

latest603 B
Original Source

DXWIN0007: Invocation without Handle

  • May 06, 2022

Severity: Warning

Calling a BeginInvoke or Invoke method for a control that has no handle associated with it causes an error. Always check the IsHandleCreated property to avoid this scenario.

Invalid Code

csharp
myControl.BeginInvoke(new Action(() => {
    // TODO
}));

Valid Code

csharp
if (this.IsHandleCreated) {
    this.BeginInvoke(new Action(() => {
        // TODO
    }));
}