0
Completed

Better reporting of error when attempt to save item to adapter with a null key value.

Shane Day (Chief Technology Officer) 13 years ago updated by anonymous 8 years ago 4

As originally reported in FINANCE-30, and resolved with that issue, when a item is to be saved, and one of the key values is null, the following error is displayed:

Errors:
Timestamp	Severity	Source	Module	Message
3/02/2011 1:30:02 PM	Error	Logging	Logging	"Unable to raise start notification:

System.NullReferenceException: Object reference not set to an instance of an object.
at Unify.Framework.MultiKeyValue.<ToString>b__0(IValue value)
at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArrayTSource(IEnumerable`1 source)
at Unify.Framework.MultiKeyValue.ToString()
at System.Text.StringBuilder.AppendFormat(IFormatProvider provider, String format, Object[] args)
at System.String.Format(IFormatProvider provider, String format, Object[] args)
at System.String.Format(String format, Object arg0, Object arg1, Object arg2)
at Unify.Notification.ConnectorModifyAnchorEntityNotificationFactory.GetConnectorServiceProcessDetail()
at Unify.Notification.ConnectorNotificationFactory.GetServiceProcessDetail()
at Unify.Notification.TaskNotifier`1..ctor(INotificationMessageService messageService, T factory)"

Timestamp	Severity	Source	Module	Message
3/02/2011 1:30:02 PM	Warning	Adapter request to save entity to adapter space failed.	Adapter	"Adapter request to save entity 531f8d06-81b1-488f-b5e8-6dc932a0093d
to adapter space 278900c3-9b42-4c36-9400-6f1e5eb3354a failed with reason Object reference not set to an instance of an object.. 
Duration: 00:00:00.1718750
Error details:
System.NullReferenceException: Object reference not set to an instance of an object.
at Unify.Notification.TaskNotifier`1.Dispose()
at Unify.Framework.EventNotifierModifyAnchorConnectorDecorator.ModifyAnchor(MultiKeyValue oldKey, MultiKeyValue newKey)
at Unify.Framework.Adapter.<>c_DisplayClass34.<CheckAnchorChangeOnSave>b_2f(KeyValuePair`2 keyValue)
at Unify.Framework.Visitor.<>c_DisplayClass1`1.<Visit>b_0(T item, Int32 index)
at Unify.Framework.Visitor.VisitT(IEnumerable`1 visitCollection, Action`2 visitor)
at Unify.Framework.Visitor.VisitT(IEnumerable`1 visitCollection, Action`1 visitor)
at Unify.Framework.Adapter.CheckAnchorChangeOnSave(IEntitySchema connectorSchema, IEnumerable`1 entitiesToSave, IEntityPartitionUpdatableContext connectorContext, IEnumerable`1 entityIds)
at Unify.Framework.Adapter.SaveEntities(IEnumerable`1 entities, Boolean reflect)
at Unify.Framework.Adapter.SaveEntity(IAdapterEntity entity, Boolean reflect)
at Unify.Framework.Adapter.SaveEntity(IAdapterEntity entity)
at Unify.Framework.AdapterNotifierDecorator.SaveEntity(IAdapterEntity entityToSave)
at Unify.Framework.LDIFAdapter.ExportAdapterEntity(IAdapterEntity adapterEntity, Guid adapterId)
at Unify.Framework.LDIFAdapterServiceHostDecorator.ExportAdapterEntity(IAdapterEntity adapterEntity, Guid adapterId)
at SyncInvokeExportAdapterEntity(Object , Object[] , Object[] )
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)"

It would be better if an explanation is given instead of a NullReferenceException.

Reassigned due to change in project ownership.

Tony, please add a message for the above case.

This has been seen on FINANCE-30 and BCE-107.

See Matthews comments on BCE-107 for an explanation of the cause of the problem and for the steps to reproduce and test.

The message will likely be in Adapter.CheckAnchorChangeOnSave, inside the entitiesToSaveKeyValues.Visit method.

Reassigned for confirmation of completion.