Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat causes: Unix transport error?
    primarykey
    data
    text
    <p>I'm doing unit test(using NUnit) on Postgresql, unfortunately it causes an error:</p> <pre><code>Internal error RemotingException: Unix transport error. </code></pre> <p>Note: The error doesn't happen if I'm using Sqlite</p> <p>Code:</p> <pre><code> using System; using ncfg = NHibernate.Cfg; using System.Collections.Generic; using System.Reflection; using NHibernate; using System.Data; using NHibernate.Tool.hbm2ddl; using NHibernate.Dialect; using NHibernate.Driver; using NHibernate.ByteCode.LinFu; using NUnit.Framework; using NHibernate.Mapping; namespace RuntimeNhibernate { class MainClass { public static void Main (string[] args) { using(var c = new BlogTestFixture()) { c.CanSaveAndLoadBlog(); } } } public class InMemoryDatabaseTest : IDisposable { private static ncfg.Configuration Configuration; private static ISessionFactory SessionFactory; protected ISession session; public InMemoryDatabaseTest(Assembly assemblyContainingMapping) { if (Configuration == null) { Configuration = new ncfg.Configuration() .SetProperty(ncfg.Environment.ReleaseConnections,"on_close") .SetProperty(ncfg.Environment.Dialect, typeof (SQLiteDialect).AssemblyQualifiedName) .SetProperty(ncfg.Environment.ConnectionDriver, typeof(SQLite20Driver).AssemblyQualifiedName) .SetProperty(ncfg.Environment.ConnectionString, "data source=:memory:") .SetProperty(ncfg.Environment.ProxyFactoryFactoryClass, typeof (ProxyFactoryFactory).AssemblyQualifiedName) .AddAssembly(assemblyContainingMapping); /*Configuration = new ncfg.Configuration() .SetProperty(ncfg.Environment.ReleaseConnections,"on_close") .SetProperty(ncfg.Environment.Dialect, typeof (PostgreSQLDialect).AssemblyQualifiedName) .SetProperty(ncfg.Environment.ConnectionDriver, typeof(NpgsqlDriver).AssemblyQualifiedName) .SetProperty(ncfg.Environment.ConnectionString, "Server=127.0.0.1;Database=memdb;User ID=postgres;Password=password;Pooling=false;") .SetProperty(ncfg.Environment.ProxyFactoryFactoryClass, typeof (ProxyFactoryFactory).AssemblyQualifiedName) .AddAssembly(assemblyContainingMapping);*/ SessionFactory = Configuration.BuildSessionFactory(); } session = SessionFactory.OpenSession(); new SchemaExport(Configuration).Execute(true, true, false, session.Connection, Console.Out); } public void Dispose() { session.Dispose(); } }//class InMemory public class Blog { public virtual int BlogId { get; set; } public virtual bool AllowsComments { set; get; } public virtual DateTime CreatedAt { get; set; } public virtual string Subtitle { get; set; } public virtual string Title { get; set; } } [TestFixture] public class BlogTestFixture : InMemoryDatabaseTest { public BlogTestFixture() : base(typeof(Blog).Assembly) { } [Test] public void IsOK() { Assert.AreEqual(true, true); return; } [Test] public void CanSaveAndLoadBlog() { object id; using (var tx = session.BeginTransaction()) { id = session.Save(new Blog { AllowsComments = true, CreatedAt = new DateTime(2000,1,1), Subtitle = "Hello", Title = "World", }); tx.Commit(); } session.Clear(); Console.WriteLine("Hello {0}", id); using (var tx = session.BeginTransaction()) { var blog = session.Get&lt;Blog&gt;(id); Assert.AreEqual(new DateTime(2000, 1, 1), blog.CreatedAt); Assert.AreEqual("Hello", blog.Subtitle); Assert.AreEqual("World", blog.Title); Assert.AreEqual(true, blog.AllowsComments); tx.Commit(); } } }//Test }//namespace </code></pre> <p>What could be the possible reason when I unit test Postgresql, it results to <strong>RemotingException: Unix transport error.</strong> ?</p> <p>If I run the code outside of unit test (e.g. Main), it works. Btw, if I unit test Sqlite, it doesn't cause any errors too</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload