help with error log - user not being created?

Topics: Troubleshooting, Writing modules
Mar 20, 2012 at 9:19 PM
Edited Mar 20, 2012 at 9:20 PM

Hey guys,
I created a module that attaches an address part etc. to the user type.  Creating users through my registration frontend performs correctly, but when I go to manually add a user through admin, it reports that such was successful, but no user eventually exists in the DB.  I have debugged admins create procedure and where I thought it would be breaking at the IsValid.Model, it wasn’t?  For when my module is disabled, the admin user creation works fine; obviously the addition of fields to the user type is causing it grief somehow, but I can’t seem to debug why? A date parameter [which I assume is CreatedAt], seems to be invalid...

 

2012-03-21 08:14:01,421 [95] NHibernate.AdoNet.AbstractBatcher - Could not execute command: INSERT INTO TNS_Donations_MemberPartRecord (Lifetime, FirstName, LastName, Street1, Street2, City, State, PostCode, CreatedAt, Id) VALUES (@p0, @p1, @p2, @p3, @p4, @p5, @p6, @p7, @p8, @p9)
System.Data.SqlTypes.SqlTypeException: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
   at System.Data.SqlTypes.SqlDateTime.FromTimeSpan(TimeSpan value)
   at System.Data.SqlTypes.SqlDateTime.FromDateTime(DateTime value)
   at System.Data.SqlClient.MetaType.FromDateTime(DateTime dateTime, Byte cb)
   at System.Data.SqlClient.TdsParser.WriteValue(Object value, MetaType type, Byte scale, Int32 actualLength, Int32 encodingByteSize, Int32 offset, TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.TdsExecuteRPC(_SqlRPC[] rpcArray, Int32 timeout, Boolean inSchema, SqlNotificationRequest notificationRequest, TdsParserStateObject stateObj, Boolean isCommandProc)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at NHibernate.AdoNet.AbstractBatcher.ExecuteNonQuery(IDbCommand cmd)
2012-03-21 08:14:01,422 [95] Orchard.ContentManagement.DefaultContentManager - SqlTypeException thrown from IContentHandler by Orchard.Indexing.Handlers.CreateIndexingTaskHandler
System.Data.SqlTypes.SqlTypeException: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
   at System.Data.SqlTypes.SqlDateTime.FromTimeSpan(TimeSpan value)
   at System.Data.SqlTypes.SqlDateTime.FromDateTime(DateTime value)
   at System.Data.SqlClient.MetaType.FromDateTime(DateTime dateTime, Byte cb)
   at System.Data.SqlClient.TdsParser.WriteValue(Object value, MetaType type, Byte scale, Int32 actualLength, Int32 encodingByteSize, Int32 offset, TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.TdsExecuteRPC(_SqlRPC[] rpcArray, Int32 timeout, Boolean inSchema, SqlNotificationRequest notificationRequest, TdsParserStateObject stateObj, Boolean isCommandProc)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at NHibernate.AdoNet.AbstractBatcher.ExecuteNonQuery(IDbCommand cmd)
   at NHibernate.AdoNet.NonBatchingBatcher.AddToBatch(IExpectation expectation)
   at NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id, Object[] fields, Boolean[] notNull, Int32 j, SqlCommandInfo sql, Object obj, ISessionImplementor session)
   at NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id, Object[] fields, Object obj, ISessionImplementor session)
   at NHibernate.Action.EntityInsertAction.Execute()
   at NHibernate.Engine.ActionQueue.Execute(IExecutable executable)
   at NHibernate.Engine.ActionQueue.ExecuteActions(IList list)
   at NHibernate.Engine.ActionQueue.ExecuteInserts()
   at NHibernate.Event.Default.AbstractSaveEventListener.PerformSaveOrReplicate(Object entity, EntityKey key, IEntityPersister persister, Boolean useIdentityColumn, Object anything, IEventSource source, Boolean requiresImmediateIdAccess)
   at NHibernate.Event.Default.AbstractSaveEventListener.PerformSave(Object entity, Object id, IEntityPersister persister, Boolean useIdentityColumn, Object anything, IEventSource source, Boolean requiresImmediateIdAccess)
   at NHibernate.Event.Default.AbstractSaveEventListener.SaveWithGeneratedId(Object entity, String entityName, Object anything, IEventSource source, Boolean requiresImmediateIdAccess)
   at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.SaveWithGeneratedOrRequestedId(SaveOrUpdateEvent event)
   at NHibernate.Event.Default.DefaultSaveEventListener.SaveWithGeneratedOrRequestedId(SaveOrUpdateEvent event)
   at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.EntityIsTransient(SaveOrUpdateEvent event)
   at NHibernate.Event.Default.DefaultSaveEventListener.PerformSaveOrUpdate(SaveOrUpdateEvent event)
   at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.OnSaveOrUpdate(SaveOrUpdateEvent event)
   at NHibernate.Impl.SessionImpl.FireSave(SaveOrUpdateEvent event)
   at NHibernate.Impl.SessionImpl.Save(Object obj)
   at Orchard.Data.Repository`1.Create(T entity) in C:\orc146\src\Orchard\Data\Repository.cs:line 96
   at Orchard.Data.Repository`1.Orchard.Data.IRepository<T>.Create(T entity) in C:\orc146\src\Orchard\Data\Repository.cs:line 36
   at Orchard.Indexing.Services.IndexingTaskManager.CreateTask(ContentItem contentItem, Int32 action)
   at Orchard.Indexing.Services.IndexingTaskManager.CreateUpdateIndexTask(ContentItem contentItem)
   at Orchard.Indexing.Handlers.CreateIndexingTaskHandler.CreateIndexingTask(PublishContentContext context, ContentPart part)
   at Orchard.ContentManagement.Handlers.ContentHandler.InlineStorageFilter`1.Published(PublishContentContext context, TPart instance) in C:\orc146\src\Orchard\ContentManagement\Handlers\ContentHandler.cs:line 156
   at Orchard.ContentManagement.Handlers.StorageFilterBase`1.Orchard.ContentManagement.Handlers.IContentStorageFilter.Published(PublishContentContext context) in C:\orc146\src\Orchard\ContentManagement\Handlers\StorageFilterBase.cs:line 81
   at Orchard.ContentManagement.Handlers.ContentHandler.Orchard.ContentManagement.Handlers.IContentHandler.Published(PublishContentContext context) in C:\orc146\src\Orchard\ContentManagement\Handlers\ContentHandler.cs:line 274
   at Orchard.ContentManagement.DefaultContentManager.<>c__DisplayClass3d.<Publish>b__3b(IContentHandler handler) in C:\orc146\src\Orchard\ContentManagement\DefaultContentManager.cs:line 342
   at Orchard.InvokeExtensions.Invoke[TEvents](IEnumerable`1 events, Action`1 dispatch, ILogger logger) in C:\orc146\src\Orchard\InvokeExtensions.cs:line 19
2012-03-21 08:14:01,428 [95] NHibernate.AssertionFailure - An AssertionFailure occurred - this may indicate a bug in NHibernate or in your custom types.
NHibernate.AssertionFailure: null id in Orchard.Indexing.Models.IndexingTaskRecord entry (don't flush the Session after an exception occurs)
2012-03-21 08:14:01,428 [95] NHibernate.Impl.AbstractSessionImpl - DTC transaction prepre phase failed
NHibernate.AssertionFailure: null id in Orchard.Indexing.Models.IndexingTaskRecord entry (don't flush the Session after an exception occurs)
   at NHibernate.Event.Default.DefaultFlushEntityEventListener.CheckId(Object obj, IEntityPersister persister, Object id, EntityMode entityMode)
   at NHibernate.Event.Default.DefaultFlushEntityEventListener.GetValues(Object entity, EntityEntry entry, EntityMode entityMode, Boolean mightBeDirty, ISessionImplementor session)
   at NHibernate.Event.Default.DefaultFlushEntityEventListener.OnFlushEntity(FlushEntityEvent event)
   at NHibernate.Event.Default.AbstractFlushingEventListener.FlushEntities(FlushEvent event)
   at NHibernate.Event.Default.AbstractFlushingEventListener.FlushEverythingToExecutions(FlushEvent event)
   at NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent event)
   at NHibernate.Impl.SessionImpl.Flush()
   at NHibernate.Transaction.AdoNetWithDistrubtedTransactionFactory.DistributedTransactionContext.System.Transactions.IEnlistmentNotification.Prepare(PreparingEnlistment preparingEnlistment)

Can anyone point me in the right direction to ascertain why it's not working? thanks for your time, dyrgutt

Mar 20, 2012 at 10:54 PM

Looking into DateTime not allowed to be nullable in C#...fingers crossed.

Mar 20, 2012 at 11:43 PM

This is driving me insane, I continually get the same error no matter what I try, even when I put a default date in the DB?

How can I see the values of my fields:

2012-03-21 08:14:01,421 [95] NHibernate.AdoNet.AbstractBatcher - Could not execute command: INSERT INTO TNS_Donations_MemberPartRecord (Lifetime, FirstName, LastName, Street1, Street2, City, State, PostCode, CreatedAt, Id) VALUES (@p0, @p1, @p2, @p3, @p4, @p5, @p6, @p7, @p8, @p9)
via debug? Please help if you can, cheers dyrgutt

Mar 20, 2012 at 11:48 PM

Maybe you can try tracing from SQL server? 

Coordinator
Mar 21, 2012 at 12:01 AM

In your Record, use DateTime? instead of DateTime.

Mar 21, 2012 at 12:18 AM

Thanks TheMonarch, admittedly i've never used sql trace, so upon doing so, what should I select [...not knowing what attributes to trace I selected everything from RPC, TSQL], and ran my site, when I got to creating a user - no data was logged; is the above error command even making it to the db? cheers dyrgutt

Mar 21, 2012 at 12:19 AM

sorry sebastienros, replied as you were - I will check it out mate, cheers.

Mar 21, 2012 at 12:26 AM

I just read your last post about how to see the values being passed to the database; not your entire question. Yeah, do what Sebastien said. 

Mar 21, 2012 at 12:32 AM

That's the one guys!!!!!!!!!!  So i'll have to change my migration as well then:

.Column<DateTime>("CreatedAt"), c => c.NotNull())

to just

.Column<DateTime>("CreatedAt")

a thousand thanks guys, i have a deadline with this webiste [...I have a lot of graphic design to finish, but i'm wasting it all on coding due to my inexperience] - this has helped 'truck loads'! cheers dyrgutt