L0FKA/midi-dot-net

Uncaught exception "CallbackOnCollectDelegate was detected"

GoogleCodeExporter opened this issue · 1 comments

If GC.Collect() is called after MidiInputDevice.Open() is called, such as
when used in Windows Forms, the following exception can occur:

"CallbackOnCollectDelegate was detected"
-A callback was made on a garbage collected delegate of type 'Midi!
Midi.Win32API+MidiInProc::Invoke'. This may cause application crashes,
corruption and data loss. When passing delegates to unmanaged code,
they must be kept alive by the managed application until it is
guaranteed that they will never be called."

The problem is that MidiInputDevice.Open() passes a delegate to unmanaged
code (the Win32 API) but doesn't retain a reference to that delegate.

Fix coming soon.

Original issue reported on code.google.com by tom_loko...@yahoo.com on 16 Dec 2009 at 7:32

Fixed in 1.0.5.

Original comment by tom_loko...@yahoo.com on 17 Dec 2009 at 1:08

  • Changed state: Verified