I've added a method returning an IAsyncEnumerable<MyClass>
to my SignalR hub method. However, instead of an object array, it seems to serialize the IAsyncEnumerable
object itself. Right now, the client receives the following object:
{
"<>1__state": -2,
"<>t__builder": {},
"<>v__promiseOfValueOrEnd": {
"RunContinuationsAsynchronously": false,
"Version": 0
},
"<>3__cargoListID": 13
}
Here's the source code of my hub:
public class CargoListHub : Hub
{
public IAsyncEnumerable<OrtecDetails> GetOrtecDetails(int cargoListID)
{
return OrtecDetails.GetOrtecDetails(cargoListID);
}
}
public record OrtecDetails
{
internal static async IAsyncEnumerable<OrtecDetails> GetOrtecDetails(int cargoListID)
{
using DatabaseEntities db = new();
DateTime ortecReferenceDate = await someSql();
IQueryable<string> allVKOs = someQuery();
foreach (string vko in allVKOs.Distinct())
{
string pathToPDF = GetOrtecPath(vko, ortecReferenceDate);
yield return CreateFromPDF(pathToPDF);
}
}
}
The project is written in .NET Framework 4.8 with SignalR 2.4.3.
How can I fix this?