NullReferenceException in Unknown Module


G

Guest

I've written a VB.NET class library which encapsulates various Win32 hooks,
such as WH_GETMESSAGE, WH_CALLWNDPROC, and WH_CALLWNDPROCRET. The hooks
appear to be set properly, and I get a few callbacks from them, but not long
afterwards I get a "System.NullReference Exception in Unknown Module"
message. To me, this implies that the exception is coming out of .NET. The
only relevant thing I've found thus far is a MSDN article entitled: "You
receive an error message when you perform asynchronous receive operations on
a Message Queuing dependent client", which explains that you get this message
when .NET does garbage collection on an object before the callback fires.
Does anybody have any ideas about what might cause my problem and how to fix
it?

Thanks...

Dan
 
Ad

Advertisements

M

Mattias Sjögren

Does anybody have any ideas about what might cause my problem and how to fix
Failure to keep a reference to the callback delegate instance you pass
to SetWindowsHookEx. If the delegate gets garbage collected, the
callback address is invalid.


Mattias
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top