Earlz / midi-dot-net

Automatically exported from code.google.com/p/midi-dot-net
0 stars 0 forks source link

Uncaught exception "CallbackOnCollectDelegate was detected" #2

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
Fixed in 1.0.5.

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