I recently had to debug a problem on our robot where Preferences weren’t loading reliably at startup. It turned out that we had a lot of subsystems loading as static constructors in the Robot class. When I moved them all into robotInit(), the problems went away.
But I’m still leery.
Q1: Are there any guarantees in the framework that Preferences and NetworkTables will be fully loaded and stable before robotInit is called?
Q2: If Preferences and NetworkTables are unsafe to use before robotInit, why are there no protections built into them so they can report this type of unsafe usage? e.g., why don’t they throw during getInstance() if the service is not ready. The current behavior of silent failure is actually much worse than dealing with an exception.