Debugging WskDeregister

The reference text says that WskDeregister will block until

  • All captured instances of the provider NPI are released.
  • Any outstanding calls to functions pointed to by WSK_PROVIDER_DISPATCH members have returned.
  • All sockets are closed.

As far as I can tell I have completed all of these tasks, yet WskDeregister is still blocking.

How can I determine what operations are still outstanding?

How can I prevent the current situation which is that WskDeregister blocks forever and prevents my driver from unloading?

I am currently trying to debug the driver so I frequently want to unload it so I can load a new version.