In the past (10.11 to 10.14), to debug a System Pref Pane, you could make a copy of System Preferences and self-sign it, then use this copy as the debug target. This method bypassed the System Integrity Protection restrictions.
With Catalina, all third party prefPanes are now loaded in a system process called "legacyLoader". This is located at:
/System/Library/Frameworks/PreferencePanes.framework/Versions/A/XPCServices/legacyLoader.xpc/Contents/MacOS/legacyLoader
Self-signing a copy of legacyLoader is no longer possible. Although you can obviously still make a copy and self-sign it, there is no way to force System Preferences to use the modified self-signed copy as it will always launch the built-in, Apple-signed legacyLoader.
The only way I can see on 10.15 to debug a prefPane is to disable SIP system-wide. Not a great solution.
Does anyone know a way to debug something in legacyLoader without disabling SIP?
I have tried creating my own host application to load the prefPane during development but I have run into a few bugs that only show up when running in System Preferences (legacyLoader) that do not show up when running in my own host.
I really need a way to debug these in the real environment without the inherent security risks of disabling SIP.