c# core async/await stops debugging

.net-core c# entity-framework-core

Question

I have a solution with multiple projects. Its build in .NET Core 2.2 and uses for example .NET EF. When calling a async method the debugger stops, no exception, try.. catch around it doesn't catch the error, debugger goes direct to the end of the console application. Cleaned up all bin/obj folders, removed .vs folder, checked all nuget packages for updates.

The code where it stopped it this moment is where I query EF async. But before this I got the same error while executing other async functions of web-requests. All thirdparty libraries from Microsoft. After adding .wait() or .result the problem is solved and I can contine.

tRepository.Queryable().Where(q => q.Tenant.Guid == iBaseTenant.Guid).ToListAsync();

The program '[17052] dotnet.exe' has exited with code 0 (0x0). The program '[17052] dotnet.exe: Program Trace' has exited with code 0 (0x0).

1
0
2/9/2019 2:57:31 PM

Accepted Answer

Found the solution, I forgot to add a await on a higher level. This function itself had the await, but the function calling this function was executed via a foreach loop where this did't wait for the result of all those items.

So when you have the same issue, please check if ALL levels have the await.

3
2/8/2019 5:02:56 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow