I am getting the following error:
CS1061 'Task' does not contain a definition for 'data' and no accessible extension method 'data' accepting a first argument of type 'Task' could be found (are you missing a using directive or an assembly reference?)
This is the line that errors out
_OldRecord = await GetPossibleDuplicateRecord(Convert.ToInt64(OldId)).data;
I believe I am getting this error because _OldRecord is null at this time. I tried to add the ? when I am declaring the variable like this:
private PossibleDuplicateRecord? _OldRecord = new PossibleDuplicateRecord();
and I still get the error. A co-worker told me to put the .data at the end of the await and both of these threw the same error. This is in the code-behind of a razor page if that is any help. I am out of ideas
Also, I have the proper using reference "using System.Threading.Tasks" so I know that the using directive is there
CodePudding user response:
Priority problem?
await GetPossibleDuplicateRecord(Convert.ToInt64(OldId)).data;
The way i read it, you await the .data, not the task.
(await GetPossibleDuplicateRecord(Convert.ToInt64(OldId))).data
would be the data.