If you call an unmanaged function and this function returns -before- the callback has been used. Then the garbage collector can reclaim the callback since as far as .Net is concerned : it doesn’t exist at all it can garbage collect it.
There’s multiple ways you can go about it.
Unfortunately it’ll be tough to debug without knowing what exactly has been garbage collected. I suggest creating a GCHandle to the delegate then freeing it after the delegate has been called if the delegate is a callback called.