[問題] CallbackOnCollectedDelegate

看板C_Sharp作者 (siraPcitsatnaF)時間15年前 (2009/02/23 01:09), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
我在我的程式中宣告名為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
文章代碼(AID): #19eORHcD (C_Sharp)