Back to Devexpress

DXWIN0009: Orphan Components

windowsforms-403903-build-an-application-security-considerations-code-diagnostics-dxwin-0009-title.md

latest619 B
Original Source

DXWIN0009: Orphan Components

  • Jul 02, 2024

Severity: Warning

All components that implement the IComponent interface must be added to the form’s private components collection (see the ‘Valid Code’ example). Otherwise, it may cause memory leaks.

To avoid this warning, use class constructors that accept parent containers (if such constructor methods exist).

Invalid Code

csharp
MVVMContext mvvmContext1 = new MVVMContext();

Valid Code

csharp
MVVMContext mvvmContext1 = new MVVMContext(this.components);