Hello,
it seems that you try to load data via NHibernate in the constructor or a method called there. The WindowsForms Designer works in the context of Visuall Studio. He processes the constructor code to render the form. You should avoid to execute code, which depends on configuration files in your application context, in this method. The reason for this is, that the configuration file is read relative to the current application path. For the designer this is the path where the executables of Visual Studio resides. If you run your application, the application path is the bin path of your solution structure. I had this problem also in a non NHibernate application which uses custom configuration files.
To avoid this problem you can try to use the DesignMode property of the form to check, if the form was created by the designer.
Regards
Klaus
|