windows-phone: Don't crash on invalid port or UID

Also update C# bindings.