Windows Forms Controls use the ApplicationThreadContext class which manages thread local storage (TLS) in a Compact Framework application. ApplicationThreadContext is not a static class, although it has some static fields, and a static constructor to initialize them. ApplicationThreadContext explicitly acquires a lock in the static constructor as proper initialization of the static fields is critical to the operation of the system. This is in-line with the ECMA specification (4th Edition, June 2006, Partition II, section 10.5.3.3), which discourages acquiring locks inside static constructors, however, does not prohibit them when explicitly invoked.
An attempt by an application to access TLS through the ApplicationThreadContext class before the first UI control has been initialized may result in a deadlock. This means that the application must wait until after the first UI control has been initialized before atempting to access TLS via the ApplicationThreadContext class. This does not mean that the UI control has to be visible; it only means that it must have been initialized.