Debugging preferences panes is tricky because they are loaded into a system process that you can’t attach to. I’ve not tried this myself but I did investigate a similar problem with Automator, which you can read about here.
Share and Enjoy
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"