Subsonic 3 – ActiveRecord – Bug DateTime with default value

Tonight I just had the weirdest bug using Subsonic 3 and I just solved it, and if it can save you some time here is the solution for my case.

If you get this error :

System.Data.SqlClient.SqlException (0x80131904): A transport-level error has occurred when sending the request to the server. (provider: Shared Memory Provider, error: 0 – No process is on the other end of the pipe.) …

only on the saving operation for one particular table in your database. If the debugger in you find it strange, you’re not alone.

After searching, I found out that I forgot to initialize a datetime field (property) on one of my object.

When a datetime is not set in .Net, it sets the date to a minimum value. This is where the problem starts. That value is not within the acceptable range for a datetime type in Microsoft SQL Server (MSSQL).

Instead of giving a clear exception, the exception thrown is a transport-level error.

Hope it helps.

Good night.

 


Posted

in

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *