Hi there, Yesterday i started checking out NHibernate. But I experienced one big problem, the program crashes in Hibernate.dll when calling Configuration.BuildSessionFactory()
But first of all my configuration. * Microsoft Visual Studio 2008 c# Express * SQL Server 2008 Express Edition * NHibernate 2.1.2 My approach was to work through a tutorial: http://docs.google.com/Doc?docid=0AUP-rKyyUMKhZGczejdxeHZfOGMydHNqdGc0&hl=en Here is my Exception A first chance exception of type 'System.InvalidOperationException' occurred in NHibernate.dll 'HelloNHibernate.vshost.exe' (Managed): Loaded 'G:\WINDOWS\assembly \GAC_MSIL\System.Transactions.resources \2.0.0.0_de_b77a5c561934e089\System.Transactions.resources.dll' System.Transactions Critical: 0 : <TraceRecord xmlns="http:// schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/ TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/ Unhandled</TraceIdentifier><Description>Unbehandelte Ausnahme</ Description><AppDomain>HelloNHibernate.vshost.exe</ AppDomain><Exception><ExceptionType>System.InvalidOperationException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ ExceptionType><Message>Instanzausfall.</Message><StackTrace> bei System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject) bei System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) bei System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) bei System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) bei System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) bei System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) bei System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) bei System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) bei System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) bei System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) bei System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) bei System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) bei System.Data.SqlClient.SqlConnection.Open() bei NHibernate.Connection.DriverConnectionProvider.GetConnection() bei NHibernate.Tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.Prepare() bei NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.GetReservedWords(Dialect dialect, IConnectionHelper connectionHelper) bei NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.Update(ISessionFactory sessionFactory) bei NHibernate.Impl.SessionFactoryImpl..ctor(Configuration cfg, IMapping mapping, Settings settings, EventListeners listeners) bei NHibernate.Cfg.Configuration.BuildSessionFactory() bei HelloNHibernate.Program.Main(String[] args) in G:\Projekte\trunk \S3000\HelloNHibernate\Program.cs:Zeile 17. bei System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() bei System.Threading.ThreadHelper.ThreadStart_Context(Object state) bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) bei System.Threading.ThreadHelper.ThreadStart()</ StackTrace><ExceptionString>System.InvalidOperationException: Instanzausfall. bei System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject) bei System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) bei System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) bei System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) bei System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) bei System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) bei System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) bei System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) bei System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) bei System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) bei System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) bei System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) bei System.Data.SqlClient.SqlConnection.Open() bei NHibernate.Connection.DriverConnectionProvider.GetConnection() bei NHibernate.Tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.Prepare() bei NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.GetReservedWords(Dialect dialect, IConnectionHelper connectionHelper) bei NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.Update(ISessionFactory sessionFactory) bei NHibernate.Impl.SessionFactoryImpl..ctor(Configuration cfg, IMapping mapping, Settings settings, EventListeners listeners) bei NHibernate.Cfg.Configuration.BuildSessionFactory() bei HelloNHibernate.Program.Main(String[] args) in G:\Projekte\trunk \S3000\HelloNHibernate\Program.cs:Zeile 17. bei System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() bei System.Threading.ThreadHelper.ThreadStart_Context(Object state) bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) bei System.Threading.ThreadHelper.ThreadStart()</ExceptionString></ Exception></TraceRecord> Here is my program: using System; using System.Collections.Generic; using System.Linq; using System.Text; using NHibernate; using NHibernate.Cfg; using NHibernate.Tool.hbm2ddl; namespace HelloNHibernate { class Program { static void Main(string[] args) { Configuration config = new Configuration(); config.AddAssembly(typeof(Product).Assembly); // The following line causes the stack trace ISessionFactory sessionFactory = config.BuildSessionFactory(); var schema = new SchemaExport(config); schema.Create(true, true); } } } My mapping file Product.hbm.xml <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="HelloNHibernate" namespace="HelloNHibernate"> <class name="Product" table="Products"> <id name="ProductId"> <generator class="identity"/> </id> <property name="ProductName" length="50" /> </class> </hibernate-mapping> The appconfig file <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name="hibernate-configuration" requirePermission="false" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" /> </configSections> <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"> <reflection-optimizer use="false" /> <session-factory> <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</ property> <property name="dialect">NHibernate.Dialect.MsSql2005Dialect</ property> <property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</ property> <property name="connection.connection_string">Data Source=POLIZISTENDUZER\\SQLEXPRESS; Initial Catalog=Pegasus; Integrated Security=True;</property> <property name='proxyfactory.factory_class'>NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property> <property name="show_sql">true</property> </session-factory> </hibernate-configuration> </configuration> I believe there is something wrong with my NHibernate configuration. Any help appreciated regards Jürgen -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
