作者Psycap (siraPcitsatnaF)
看板C_Sharp
标题[问题] CallbackOnCollectedDelegate
时间Mon Feb 23 01:09:34 2009
我在我的程式中宣告名为TimerCompleteDelegate的delegate
在 debug 模式执行时一段时间之後出现以下错误讯息
CallbackOnCollectedDelegate was detected
Message: A callback was made on a garbage collected delegate of type 'test02!WakeUp.FromStandby.WakeupController+TimerCompleteDelegate::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.
解法似乎是错误讯息中的
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.
但是我还是不太清楚 unmanaged code 和 managed application 指的是什麽,
以及 delegate 要如何 keep alive?
希望有高手可以帮忙回答一下
感谢:)
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.112.30.33