Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RetrieveRecordChangeHistory: Error if history has very much entries #254

Closed
olaf-matthes opened this issue Oct 4, 2022 · 7 comments
Closed

Comments

@olaf-matthes
Copy link

If I execute RetrieveRecordChangeHistory on an object having very much audit entries (>15.000), I just get the following error message:
"Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
See the Execution Plan tab for details of where this error occurred"

@MarkMpn
Copy link
Owner

MarkMpn commented Oct 5, 2022

Thanks for the details, I'm just trying to reproduce it now. Might take me a while to create enough audit entries to get the error though!

@MarkMpn
Copy link
Owner

MarkMpn commented Oct 5, 2022

I'm now up to over 9,000 audit entries and it's still working fine. I wonder if there's something specific in one of the audit entries that's causing the problem rather than just the total number of them.

Can you check in the log file (%appdata%\MscrmTools\XrmToolBox\Logs\MarkMpn.Sql4Cds.log) to see if you can find the error in there and post all the details? If not, is there any way I can get access to this instance to reproduce the error?

@olaf-matthes
Copy link
Author

Here is the log:
2022-10-06 09:12:32.036 Error MarkMpn.Sql4Cds.Engine.ExecutionPlan.QueryExecutionException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt. ---> System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
bei MarkMpn.Sql4Cds.Engine.ExecutionPlan.ExecuteMessageNode.SerializeAttributeAuditValues(Entity entity)
bei MarkMpn.Sql4Cds.Engine.ExecutionPlan.ExecuteMessageNode.GetAuditEntity(AuditDetail audit)
bei System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() bei System.Collections.Generic.List1..ctor(IEnumerable1 collection) bei System.Linq.Enumerable.ToList[TSource](IEnumerable1 source)
bei MarkMpn.Sql4Cds.Engine.ExecutionPlan.ExecuteMessageNode.GetEntityCollection(OrganizationResponse response)
bei MarkMpn.Sql4Cds.Engine.ExecutionPlan.ExecuteMessageNode.d__66.MoveNext()
bei MarkMpn.Sql4Cds.Engine.ExecutionPlan.BaseDataNode.d__14.MoveNext()
--- Ende der internen Ausnahmestapelüberwachung ---
bei MarkMpn.Sql4Cds.Engine.ExecutionPlan.BaseDataNode.d__14.MoveNext()
bei MarkMpn.Sql4Cds.Engine.ExecutionPlan.AliasNode.d__17.MoveNext()
bei MarkMpn.Sql4Cds.Engine.ExecutionPlan.BaseDataNode.d__14.MoveNext()
bei MarkMpn.Sql4Cds.Engine.ExecutionPlan.NestedLoopNode.d__8.MoveNext()
bei MarkMpn.Sql4Cds.Engine.ExecutionPlan.BaseDataNode.d__14.MoveNext()
bei MarkMpn.Sql4Cds.Engine.ExecutionPlan.FilterNode.d__8.MoveNext()
bei MarkMpn.Sql4Cds.Engine.ExecutionPlan.BaseDataNode.d__14.MoveNext()
bei MarkMpn.Sql4Cds.Engine.ExecutionPlan.ComputeScalarNode.d__7.MoveNext()
bei MarkMpn.Sql4Cds.Engine.ExecutionPlan.BaseDataNode.d__14.MoveNext()
bei MarkMpn.Sql4Cds.Engine.ExecutionPlan.SelectDataReader.Read()
bei MarkMpn.Sql4Cds.Engine.Sql4CdsDataReader.Read()
bei System.Data.Common.DataAdapter.FillLoadDataRow(SchemaMapping mapping)
bei System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue)
bei System.Data.Common.DataAdapter.Fill(DataTable[] dataTables, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)
bei System.Data.DataTable.Load(IDataReader reader, LoadOption loadOption, FillErrorEventHandler errorHandler)
bei MarkMpn.Sql4Cds.SqlQueryControl.backgroundWorker_DoWork(Object sender, DoWorkEventArgs e)
bei System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
bei System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)

@olaf-matthes
Copy link
Author

I'm afraid you are right that it does not depend on the high number of entries. Sorry for sending you in the wrong direction.
On the affected entities, the problem may be caused by entries of event type "Disassociate entities"

@MarkMpn
Copy link
Owner

MarkMpn commented Oct 8, 2022

I've tested this on my instances and it still works with a Disassociate type audit entry. I can't reproduce the error so far but thanks to your stack trace details I can see where it's occurring so I can try to add in a potential fix in the next update anyway.

MarkMpn added a commit that referenced this issue Oct 8, 2022
MarkMpn added a commit that referenced this issue Oct 9, 2022
@MarkMpn
Copy link
Owner

MarkMpn commented Oct 27, 2022

@olaf-matthes Can you confirm if you can still reproduce this error with the latest version please?

@olaf-matthes
Copy link
Author

olaf-matthes commented Oct 27, 2022 via email

@MarkMpn MarkMpn closed this as completed Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants