As per this thread I was using ContentRelation.GetRelatedDocument to get the document that matched an old ID held in the CSV file that is being imported. In version 2.3.2 this seemed to be working although I didn't really get a proper chance to fully test. With version 2.3.3 I am getting the following exception with it. The adapter, key name and key value are all set so I don't understand what object is not set.
CMSImport content import: Error in third party event handler during
Importing event:System.NullReferenceException: Object reference not set
to an instance of an object.
at .(String )
at
CMSImport.Extensions.Relations.ContentRelation.GetRelatedDocument(String
dataAdapter, String dataKeyName, Object dataKeyValue)
at
SeevicCollege.ImportEvents.ContentImportEvents.ContentImport_RecordImporting(Object
sender, RecordImportingEventArgs e) in
P:\BGNM169_SeevicCollege_Website_190612\solution\Forms\BLL\ImportEvents\Events.cs:line
60
at
CMSImport.Extensions.Import.ContentImport.FireRecordImporting(Document
doc, String dataSourceAlias, String dataKey, Object dataKeyValue,
IDataReader reader)
The code that throws the error is
Document d = ContentRelation.GetRelatedDocument(e.DataAdapter, e.DataKeyName, e.Items["Old Course Code"]);
Has something changed with this. Or has it working just been wishful thinking.
This is my event handler. I've cut some lines from it as they just set property values in the same way as the two I've left in. When debugging e.DataAdapter, e.DataKeyName and e.Items["Old Course Code"] all show as having a value.
System.NullReferenceException was unhandled by user code HResult=-2147467261 Message=Object reference not set to an instance of an object. Source=CMSImport.Extensions StackTrace: at .(String ) at CMSImport.Extensions.Relations.ContentRelation.GetRelatedDocument(String dataAdapter, String dataKeyName, Object dataKeyValue) at SeevicCollege.ImportEvents.ContentImportEvents.ContentImport_RecordImporting(Object sender, RecordImportingEventArgs e) in P:\BGNM169_SeevicCollege_Website_190612\solution\Forms\BLL\ImportEvents\Events.cs:line 60 at CMSImport.Extensions.Import.ContentImport.FireRecordImporting(Document doc, String dataSourceAlias, String dataKey, Object dataKeyValue, IDataReader reader) InnerException:
Has ContentRelation.GetRelatedDocument changed
As per this thread I was using ContentRelation.GetRelatedDocument to get the document that matched an old ID held in the CSV file that is being imported. In version 2.3.2 this seemed to be working although I didn't really get a proper chance to fully test. With version 2.3.3 I am getting the following exception with it. The adapter, key name and key value are all set so I don't understand what object is not set.
The code that throws the error is
Has something changed with this. Or has it working just been wishful thinking.
Hi Suzy,
The only difference between 2.3.2 and 2.3.3 is a new licensing dll. Can you check using a breakpoint if e.items["Old Course Code"] Exists?
Thanks,
Richard
It does exist. I check it isn't null before doing that line but also checking in the debugger shows it is there and has a value.
Is the following line returning null? Maybe you can post the complete event handler you are using?
This is my event handler. I've cut some lines from it as they just set property values in the same way as the two I've left in. When debugging e.DataAdapter, e.DataKeyName and e.Items["Old Course Code"] all show as having a value.
This is the exception details
Any idea why this isn't working.
Hi Suzy,
Sorry didn't see the reply which version of Umbraco are you using then I'll try myself
Thanks,
Richard
4.11.4
Is it possible to send me the datasource also? [email protected] then I have all info.
Thanks,
Richard
is working on a reply...