Strange LINQ Exception (Index out of bounds)

后端 未结 5 1113
天命终不由人
天命终不由人 2020-12-14 12:15

I have a table, we\'ll call Users. This table has a single primary key defined in SQL Server - an autoincrement int ID.

Sometimes, my LINQ

5条回答
  •  隐瞒了意图╮
    2020-12-14 12:23

    This almost certainly won't be everyone's root cause, but I encountered this exact same exception in my project - and found that the root cause was that an exception was being thrown during construction of an entity class. Oddly, the true exception is "lost" and instead manifests as an ArgumentOutOfRange exception originating at the iterator of the Linq statement that retrieves the object/s.

    If you are receiving this error and you have introduced OnCreated or OnLoaded methods on your POCOs, try stepping through those methods.

提交回复
热议问题