'Deadlock on Select from table-valued parameter

I have this piece of code which acquires connection from EF Core DB context and executes select on the received data.

var conn = _dbContext.Database.GetDbConnection() as SqlConnection;
await conn.OpenIfNotAlreadyOpenAsync();

await conn.ExecuteAsync(@"select col2 from @Data",
new
{
    Data = data.AsTableValuedParameter("DataType")
});

The app is run as a .NET Core (3.1) Web API and uses SQL Server as a database.
Code is executed on each request to endpoint.
Everything is run locally, so there are no intervening operations on this Database.

When I execute a single request everything is fine.
When I execute 50 requests simultaneously, I receive an exception:

Transaction (Process ID 106) was deadlocked on lock resources with another process and has
 been chosen as the deadlock victim. Rerun the transaction.
The statement has been terminated.

SQL profiler shows multiple exec sp_reset_connection statements, but no queries (at all).

enter image description here

Seems like each request fails there.

How is that possible, given that's only SELECT?
Shouldn't each request have its own temporary table?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source