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
End
Class
Class:
Public
Class
FooForm
Private
obj
As
Object
Private
Sub
Foo()
obj =
New
Object
End
Sub
End
Class
Read the question carefully.
Understand that English isn't everyone's first language so be lenient of bad
spelling and grammar.
If a question is poorly phrased then either ask for clarification, ignore it, or
edit the question
and fix the problem. Insults are not welcome.
Don't tell someone to read the manual. Chances are they have and don't get it.
Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
I don't know how you do that in VB (and if it can be done) but you have to read documentation and ensure that you understand what you are doing if you make callback from C++ code to managed VB code.