<p>If I have the following Linq code:</p>

<pre><code>context.Table1s.InsertOnSubmit(t);
context.Table1s.InsertOnSubmit(t2);
context.Table1s.InsertOnSubmit(t3);

context.SubmitChanges();
</code></pre>

<p>And I get a database error due to the 2nd insert, Linq throws an exception that there was an error.  But, is there a way to find out that it was the 2nd insert that had the problem and not the 1st or 3rd?</p>

<p>To clarify, there are business reasons that I would expect the 2nd to fail (I am using a stored procedure to do the insert and am also doing some validation and raising an error if it fails).  I want to be able to tell the user which one failed and why.  I know this validation would be better done in the C# code and not in the database, but that is currently not an option.</p>

I've seen this bug in ReSharper 4.1. It happens when the base class is in the App_Code directory. I don't know how to fix it; it is very annoying, but the code still compiles though.