Here's a VB version of the detection code that works (thanks to Jonathan Wanagel from PAG). The reason the one to one translation doesn't work is that VB tries to proactively instantiate the referenced types, instead of doing it lazily as C# does. So