Exception when dragging a control in the Visual Studio designer

If you are using the Visual Studio designer to create a WinForms or WPF app, and you drag a control into the designer, and the control calls JNBridgepro proxies as part of the constructor or other initialization, you may see an exception.  This is because the drag/drop process attempts to initialize the control, and, in this case, it will cause the proxies to be called and JNBridgePro to be invoked. Since the designer runs in the Visual Studio process, JNBridgePro will not have access to necessary licensing or configuration information, and this will cause the exception  to be thrown.

There are two ways to work around this problem:

The simplest way is to not use the designer to add the problematic control, but rather to add the control manually, by writing code.

The other approach is to identify the problematic lines that cause the proxies to be called from the designer and temporarily comment them out. After finishing with the designer, you can uncomment the lines of code.  Alternatively, you can place the problematic lines inside a try/catch block that will catch TypeInitializationExceptions and drop them on the floor. After your are done with the designer, remember to remove the try/catch block or otherwise handle the TypeInitializationExceptionss or pass them along, since it is dangerous to ignore TypeInitializationExceptions in your running application.