Components dragged onto a form which implement System.ComponentModel.IComponent are placed in a 'components' collection (an instance of System.ComponentModel.Container) for desktop/server projects. This does not occur for smart device projects.
The generated Dispose(bool) override for a Form checks whether 'components' has been initialized and if so, calls Dispose on it. However, this field is never initialized by the generated code so it is always null.
The System.ComponentModel.Component class implements a finalizer in .NET Compact Framework 2.0. The Dispose() method calls GC.SuppressFinalize(this). The designer however does not generate calls to Dispose for objects derived from Component.
System.Windows.Forms.MainMenu derives from Component, as does MenuItem. Objects of these classes are not disposed of when the owning form is disposed because of this issue. Nor are event handlers detached.
The result of this is that components are unnecessarily staying on the finalization queue and potentially a large object graph is retained after a garbage collection, due to any event handlers remaining connected to the form object. This leads to excessive memory use.
The designer should ensure that all non-graphical components dragged onto a form are disposed of when the form is disposed, to ensure that finalizers are not invoked unnecessarily.