对垃圾收集的类型委托进行了回调,这可能会导致应用程序崩溃? [英] A callback was made on a garbage collected delegate of type , this may cause application crashes?

查看:198
本文介绍了对垃圾收集的类型委托进行了回调,这可能会导致应用程序崩溃?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我正在进行从VB层到c ++ DLL的PInvoke调用并得到以下错误吗?



对垃圾收集的类型委托进行了回调'' EPSS06!EPSS32.ErrorUtilities + delbpeErrCB ::调用 ''。这可能会导致应用程序崩溃,损坏和数据丢失。将委托传递给非托管代码时,托管应用程序必须保持活动状态,直到确保永远不会被调用为止。





有没有人知道问题是什么?

解决方案

我们已经要求代码,因为这可能有助于解释你的错误。如果您没有参加,那么您希望如何获得帮助?



这可能是一个范围问题。



当地:



 公共  FooForm 
私有 Sub Foo()
Dim obj 作为 对象 = {something }
结束 Sub ' obj现在不存在并被收集
结束 班级





班级:

 公共  FooForm 
私有 obj 作为 对象
私有 Sub Foo()
obj = 对象
结束 Sub ' obj仍然存在,因为类保存变量直到它被收集
结束


Hello I am making a PInvoke call from VB layer to the c++ DLL and getting the below erro?

A callback was made on a garbage collected delegate of type ''EPSS06!EPSS32.ErrorUtilities+delbpeErrCB::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.


Does anyone have any idea what the problem is?

解决方案

We have asked for code as this may help explain where your going wrong. If you do not participate then how do you expect to get help?

It could be a scope problem.

Local:

Public Class FooForm
  Private Sub Foo()
    Dim obj As Object = {something}
  End Sub ' obj now does not exist and gets collected
End Class



Class:

Public Class FooForm
  Private obj As Object
  Private Sub Foo()
    obj = New Object
  End Sub 'obj still exist since the class holds the variable til it is collected
End Class


这篇关于对垃圾收集的类型委托进行了回调,这可能会导致应用程序崩溃?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆