When are static constructors inside of plugins run?

I had some code running in a static constructor inside a plugin I’m developing, but the code didn’t get run when the plugin loads, as I was expecting. The particular plugin was set to load at startup, and that’s worked fine (Rhino reports that the plugin is loaded, and the code in OnLoad handler runs at the expected time), but the static constructor doesn’t run until later. I can pretty easily work around this by moving the desired code into OnLoad, so I was mainly just curious about the interactions between the Rhino plugin engine and the CLR that would cause this.

We aren’t doing anything out of the ordinary here. Static constructors are called the first time you access that class.

I would tend to stay away from static constructors in general practice though. It can become difficult to determine exactly when they will be access the first time.