Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

private async Task<string> getDiscoDeviceDescription(int manufacture) { var outp

ID: 3908981 • Letter: P

Question

private async Task<string> getDiscoDeviceDescription(int manufacture)

{

var output = new sqlParameter("@deviceDescription", sqlDbType.NVarChar, 255) { Direction = ParameterDirection. Output };

await Database.ExecuteSqlCommandAsync("exec storedProcedure @manufacture,@deviceDescription OUT", new sqlParameter("@manufacture", manufacture), output);

description = (string) output.Value;

return description;

}

private async Task<string> getPopDeviceDescription(int manufacture, string serialNumber)

{

var output = new sqlParameter("@deviceDescription", sqlDbType.NVarChar, 255) { Direction = ParameterDirection. Output };

await Database.ExecuteSqlCommandAsync("exec storedProcedure @manufacture, @serialNumber, @deviceDescription OUT", new sqlParameter("@manufacture", manufacture), new sqlParameter("@serialNumber", serialNumber), output);

description = (string) output.Value;

return description;

}

public async Task<string> GetDeviceDesc(int manufacture, string serialNumber, string type)

{

switch(type)

{

case type.Disco:

return getDiscoDeviceDescription(int manufacture);

case type.Pop:

return getPopDeviceDescription(int manufacture, string serialNumber);

}

I keep getting System.AggregateException: One or more errors occurred. ---> System.NotSupportedException: A second operation started on this context before a previous asynchronous operation completed. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context. Any instance members are not guaranteed to be thread safe.

Explanation / Answer

Hi friend, Since you have not posted complete code, so I can not answer exact cause. But i can see one error in following line:

public async Task<string> GetDeviceDesc(int manufacture, string serialNumber, string type) : string is not a type, its should be String