-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sproc fixes #28942
Sproc fixes #28942
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,7 +53,7 @@ protected override void Consume(RelationalDataReader reader) | |
{ | ||
if (onResultSet == false) | ||
{ | ||
Check.DebugFail("Missing a result set"); | ||
throw new InvalidOperationException(RelationalStrings.MissingResultSetWhenSaving); | ||
} | ||
|
||
var lastHandledCommandIndex = command.RequiresResultPropagation | ||
|
@@ -75,12 +75,15 @@ protected override void Consume(RelationalDataReader reader) | |
} | ||
} | ||
|
||
Debug.Assert(onResultSet != true, "Unexpected result set found at end"); | ||
if (onResultSet == true) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that this is best-effort. Specifically, if there were no (expected) result sets, then a trailing one wouldn't be detected (since onResultSet is null here). We could add logic to check for that (calling reader.Read and NextResult), but that would potentially slow things down only for the purpose of this check. |
||
{ | ||
Dependencies.UpdateLogger.UnexpectedTrailingResultSetWhenSaving(); | ||
} | ||
|
||
reader.DbDataReader.Close(); | ||
|
||
if (hasOutputParameters) | ||
{ | ||
reader.DbDataReader.Close(); | ||
|
||
var parameterCounter = 0; | ||
IReadOnlyModificationCommand command; | ||
|
||
|
@@ -133,7 +136,7 @@ protected override void Consume(RelationalDataReader reader) | |
throw new DbUpdateException( | ||
RelationalStrings.UpdateStoreException, | ||
ex, | ||
ModificationCommands[commandIndex].Entries); | ||
ModificationCommands[commandIndex < ModificationCommands.Count ? commandIndex : ModificationCommands.Count - 1].Entries); | ||
} | ||
} | ||
|
||
|
@@ -168,7 +171,7 @@ protected override async Task ConsumeAsync( | |
{ | ||
if (onResultSet == false) | ||
{ | ||
Check.DebugFail("Missing a result set"); | ||
throw new InvalidOperationException(RelationalStrings.MissingResultSetWhenSaving); | ||
} | ||
|
||
var lastHandledCommandIndex = command.RequiresResultPropagation | ||
|
@@ -190,12 +193,15 @@ protected override async Task ConsumeAsync( | |
} | ||
} | ||
|
||
Debug.Assert(onResultSet != true, "Unexpected result set found at end"); | ||
if (onResultSet == true) | ||
{ | ||
Dependencies.UpdateLogger.UnexpectedTrailingResultSetWhenSaving(); | ||
} | ||
|
||
await reader.DbDataReader.CloseAsync().ConfigureAwait(false); | ||
|
||
if (hasOutputParameters) | ||
{ | ||
await reader.DbDataReader.CloseAsync().ConfigureAwait(false); | ||
|
||
var parameterCounter = 0; | ||
IReadOnlyModificationCommand command; | ||
|
||
|
@@ -249,7 +255,7 @@ await ThrowAggregateUpdateConcurrencyExceptionAsync( | |
throw new DbUpdateException( | ||
RelationalStrings.UpdateStoreException, | ||
ex, | ||
ModificationCommands[commandIndex].Entries); | ||
ModificationCommands[commandIndex < ModificationCommands.Count ? commandIndex : ModificationCommands.Count - 1].Entries); | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See https://github.com/dotnet/efcore/pull/28942/files#r960524847, the same holds here.