NHibernate version: 1.2.1GA
I have created a user control that references a binary created in another project. That binary uses NHibernate for its data access methods.
Development on this control has been fine until I restarted Visual Studio. Now, opening the main form brings up an error message that it has thrown an exception in design mode. The exception at had is displayed on the form in Visual studio, and is the standard exception thrown when NHibernate cannot find the XML file describing the database settings.
That is, "System,TypeInitializationException: The type initializer for 'Remoting.Factory.NHibernateFactory' threw an exception. ---> NHibernate.HibernateException: problem parsing configuration : System.IO.FileNotFoundException: Could not find file 'C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\SQLServer.cfg.xml' ..."
and on and on.
Any help on how I can keep visual studio from trying to create an NHibernate instance while I'm not running/debugging?
The offending code (in the user control)
Code:
private void userPanel_VisibleChanged(object sender, EventArgs e)
{
try
{
if (((UserControl)sender).Visible == true)
{//If visible, get and bind for both creating and editing
_cData = new DataSource();
_companyList = _cData.GetCompanyList(_thisAppGuid);
foreach (Company index in _companyList)
{
uxUserCompanyIDCombobox.Items.Add(index.CompanyNumber);
uxUserCompanyReportComboBox.Items.Add(index.CompanyNumber);
uxEditCompanyComboBox.Items.Add(index.CompanyNumber);
}
}
else
{//else, clear variables and UI components.
_cData = null;
if (_companyList != null)
_companyList.Clear();
uxUserCompanyIDCombobox.Items.Clear();
uxUserCompanyReportComboBox.Items.Clear();
uxEditCompanyComboBox.Items.Clear();
}
}
catch (Exception)
{
throw;
}
}