Efcore: EF Core 3.1.7/8 . ToListAsync() Crashed Without Throwing an Exception

Created on 11 Sep 2020  路  4Comments  路  Source: dotnet/efcore

_This issue has been moved from a ticket on Developer Community._


[severity:It's more difficult to complete my work]
I discovered this in a new Console app that I was writing. I created a stripped down version to the bare minimum and narrowed the problem down to the . ToListAsync() in a database access.

This works

        public async void Start()
        {
            try
            {
                List<Order> Orders = (from o in _context. Tbl_Orders
                                    where o.JobNumber == "DRG130"
                                    select o). AsNoTracking(). ToList();

//Console.WriteLine($"Order Count: {Orders.Count}");
                Console.WriteLine("Completed");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex. ToString());
                throw;
            }
            Console.WriteLine("End");
        }

This does not

        public async void Start()
        {
            try
            {
                List<Order> Orders = await (from o in _context. Tbl_Orders
                                    where o.JobNumber == "DRG130"
                                    select o). AsNoTracking(). ToListAsync();

//Console.WriteLine($"Order Count: {Orders.Count}");
                Console.WriteLine("Completed");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex. ToString());
                throw;
            }
            Console.WriteLine("End");
        }

Not only does it not work, but it also does not throw an exception, it simply crashes with nothing in the Output window, nothing on the console and it does not hit the breakpoint in the 'catch' clause.

Dot Net Core 3.1.402
EF Core 3.1.7 (3.1.8 behaves in a similar manner)
VS2019 16.7.3

Any help would be greatly appreciated.

Thanks.


Original Comments

Feedback Bot on 9/10/2020, 03:46 AM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.


Original Solutions

(no solutions)

closed-question customer-reported

Most helpful comment

All 4 comments

the below code also crashes the same way.
public async Task> MergeOrders(int customerId, string orderIds)
{
ResultDTO Result = new ResultDTO();
try
{
var orders = await _dbContext.Order.Where(x => x.OrderStatusId == 1).ToListAsync();
}
catch(Exception ep)
{
}
return Result;
}

Dot Net Core 3.1.402
EF Core 3.1.7 (3.1.8 behaves in a similar manner)
VS2019 16.7.3

@chaitanyasingu can you please open a new issue with a runnable code sample that shows the crash?

I just Use this await Task.FromResult(query.ToList());

Was this page helpful?
0 / 5 - 0 ratings