What are you actually trying to do? If you're on a machine joined to the domain, you should just do new DirectoryEntry()
.
As for your error, when you log on to Windows with a local account, the UserDomainName environment variable is set to the local computer name. If that machine's name is the same as the domain's NetBIOS name, then I wouldn't be surprised if Windows gets confused.