0

I have this linq query which works perfectly fine but sometimes it throws exception, following is start :

query = table.Include(x=>x.table2)

after applying few conditions in code finally following is the line which throws exception :

var data = await query.Skip(offset).Take(filter.PagingOption.PageSize).AsNoTracking().ToListAsync();

ErrorDetail : System.Data.SqlClient.SqlException (0x80131904): The column 'Id' was specified multiple times for 't'.\r\n

Mostly it is observed that when IIS is restarted error occurs, but once the error is occurred on refresh this works totally fine. Which I guess is random behavior.

Any ideas ?

Shahrukh Ahmad
  • 133
  • 1
  • 1
  • 10
  • Can you make a reliable reproduction of it? https://stackoverflow.com/questions/45893732/how-do-you-show-underlying-sql-query-in-ef-core-2-0? Maybe eg core team would fix it if it's a bug, or maybe try to repro it on efcore 3 and switch if it is immune? – Caius Jard Jun 09 '20 at 06:49
  • Doesn't the exception include the full sql? – Jeremy Lakeman Jun 09 '20 at 06:51
  • @CaiusJard reproduction is not easily possible as I to get this issue randomly – Shahrukh Ahmad Jun 09 '20 at 06:55
  • @JeremyLakeman exception includes very limited details here is the exception detail in case : The column 'Id' was specified multiple times for 't'.","ErrorDetail":"System.Data.SqlClient.SqlException (0x80131904): The column 'Id' was specified multiple times for 't'.\r\n at System.Data.SqlClient.SqlCommand.<>c.b__122_0(Task`1 result)\r\n at – Shahrukh Ahmad Jun 09 '20 at 07:00
  • Is it related - https://github.com/dotnet/efcore/issues/13922 – Caius Jard Jun 09 '20 at 07:18
  • If you set `.EnableSensitiveDataLogging(true)` the full sql and parameters of EF errors should be logged. – Jeremy Lakeman Jun 10 '20 at 06:09

0 Answers0