0
Fixed

LINQ error and entity doesn't contain Id attribute error

James Booth 11 years ago in UNIFYBroker/Microsoft Dynamics CRM updated by anonymous 9 years ago 9

Exporting to CRM, this is the result:

System.Exception: Error occurred when attempting to save entity with distinguished name
 
CN=12700
 
Error:
 
The method IEntityBase`.GetValue() is not supported in this context.  Use IEntityBase`.GetValueOrDefault() instead.
 
The method is not supported as use of this method in a LINQ statement against an implementation will result in the same exception type being thrown if the key value is not present in an instance of the entity.
   at Unify.Product.IdentityBroker.Repository.EntityExpressionQueryVisitor`4.VisitMethodCall(MethodCallExpression m)
   at Unify.Framework.ExpressionVisitorBase`11.Visit(Expression exp)
   at Unify.Framework.ExpressionExpressionVisitorBase.<VisitExpressionList>b__d(Expression originalExpression)
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Unify.Framework.ExpressionExpressionVisitorBase.VisitExpressionList(ReadOnlyCollection`1 original)
   at Unify.Framework.Data.LinqContextConversionExpressionVisitorBase`5.VisitMethodCall(MethodCallExpression m)
   at Unify.Product.IdentityBroker.Repository.EntityExpressionQueryVisitor`4.VisitMethodCall(MethodCallExpression m)
   at Unify.Framework.ExpressionVisitorBase`11.Visit(Expression exp)
   at Unify.Framework.Data.LinqContextConversionExpressionVisitorBase`5.VisitLambda(LambdaExpression lambda)
   at Unify.Framework.ExpressionVisitorBase`11.Visit(Expression exp)
   at Unify.Framework.ExpressionExpressionVisitorBase.VisitUnary(UnaryExpression u)
   at Unify.Framework.ExpressionVisitorBase`11.Visit(Expression exp)
   at Unify.Framework.ExpressionExpressionVisitorBase.<VisitExpressionList>b__d(Expression originalExpression)
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
  at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Unify.Framework.ExpressionExpressionVisitorBase.VisitExpressionList(ReadOnlyCollection`1 original)
   at Unify.Framework.Data.LinqContextConversionExpressionVisitorBase`5.VisitMethodCall(MethodCallExpression m)
   at Unify.Product.IdentityBroker.Repository.EntityExpressionQueryVisitor`4.VisitMethodCall(MethodCallExpression m)
   at Unify.Framework.ExpressionVisitorBase`11.Visit(Expression exp)
   at Unify.Framework.Data.LinqContextConversionExpressionVisitorBase`5.ConvertExpression(Expression partitionExpression)
   at Unify.Framework.Data.LinqQueryConversionProvider`5.GetOrderedQuery(Expression businessExpression, IQueryable`1 sourceQueryable, TContext sourceContext)
   at Unify.Framework.Data.LinqWhereQuery`5.GetEnumerator()
   at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
   at Unify.Product.IdentityBroker.DynamicsCrmObjectConnector.UpdateEntities(IEnumerable`1 entities)
   at Unify.Product.IdentityBroker.EventNotifierUpdatingConnectorDecorator.UpdateEntities(IEnumerable`1 entities)
   at Unify.Product.IdentityBroker.Adapter.UpdateEntities(IEnumerable`1 entities, Boolean reflect)
   at Unify.Product.IdentityBroker.AdapterNotifierDecoratorBase`1.UpdateEntity(IAdapterEntity entityToSave)
   at Unify.Product.IdentityBroker.LDIFAdapterBase.ExportChanges(ExportedLDIFForAdapter exportedLdifForAdapter)
   at SyncInvokeExportChanges(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.ProcessMessage31(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
   at Unify.Product.IdentityBroker.IdentityBrokerManagementAgentProxy.ExportEntry(ModificationType modificationType, String[] changedAttributes, CSEntry csentry)

Unify.Product.IdentityBroker.ConnectorEnginePlugInKey.extensibility.config.xml

Hi James,

Could you attach the current configuration?

Is there something that you are testing? Is there a change that has been made to the configuration?

Thanks.

Config file attached

Now getting additional errors:

System.Exception: Error occurred when attempting to save entity with distinguished name

CN=20836

Error:

Client is unable to finish the security negotiation within the configured timeout (00:00:00). The current negotiation leg is 1 (00:00:00).

Server stack trace:
at System.ServiceModel.Security.IssuanceTokenProviderBase`1.DoNegotiation(TimeSpan timeout)
at System.ServiceModel.Security.SspiNegotiationTokenProvider.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Security.SymmetricSecurityProtocol.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.SecurityChannelFactory`1.ClientSecurityChannel`1.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade)
at System.ServiceModel.Channels.ServiceChannel.EnsureOpened(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at 0:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Microsoft.Xrm.Sdk.IOrganizationService.Execute(OrganizationRequest request)
at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.ExecuteCore(OrganizationRequest request)
at Unify.Product.IdentityBroker.DynamicsCrmObjectCommunicator.RetrieveSpecialFieldTypes()
at Unify.Product.IdentityBroker.DynamicsCrmObjectConnector.GetSpecialFieldTypesInformation(IDynamicsCrmObjectCommunicator communicator)
at Unify.Product.IdentityBroker.DynamicsCrmObjectConnector.UpdateEntities(IEnumerable`1 entities)
at Unify.Product.IdentityBroker.EventNotifierUpdatingConnectorDecorator.UpdateEntities(IEnumerable`1 entities)
at Unify.Product.IdentityBroker.Adapter.UpdateEntities(IEnumerable`1 entities, Boolean reflect)
at Unify.Product.IdentityBroker.AdapterNotifierDecoratorBase`1.UpdateEntity(IAdapterEntity entityToSave)
at Unify.Product.IdentityBroker.LDIFAdapterBase.ExportChanges(ExportedLDIFForAdapter exportedLdifForAdapter)
at SyncInvokeExportChanges(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.ProcessMessage31(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
at Unify.Product.IdentityBroker.IdentityBrokerManagementAgentProxy.ExportEntry(ModificationType modificationType, String[] changedAttributes, CSEntry csentry)

Also getting this, which may be related to above.

System.ServiceModel.FaultException: 'Contact' entity doesn't contain attribute with Name = 'Id'.

Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at 0:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Unify.Product.IdentityBroker.IdentityBrokerLDIFAdapter.ILDIFAdapter.ExportChanges(ExportedLDIFForAdapter request)
at Unify.Product.IdentityBroker.IdentityBrokerManagementAgentProxy.ExportEntry(ModificationType modificationType, String[] changedAttributes, CSEntry csentry)

See v4.0.0.10 to fix the Id attribute issue.

It may also fix the other issue, as I added in a Dispose that was missing.

If the other issue persists please create a new issue as it's not related to this one.

Thanks.

Reopened, NZPPS-13 shows that this is still happening.

There are a few places where this could go wrong, and it wasn't made easy by missing the stack trace.

See v4.0.0.11 for the fix to the id issue.

System is working fine in production