NullReferenceException in Unknown Module

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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
 
Back
Top