You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
System.Data.SqlClient.SqlException (0x80131904): The variable name '@___job_0_Id' has already been declared. Variable names must be unique within a query batch or stored procedure.
at System.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__122_0(Task`1 result)
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteAsync(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary`2 parameterValues, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.BufferlessMoveNext(DbContext _, Boolean buffer, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.MoveNext(CancellationToken cancellationToken)
at System.Linq.AsyncEnumerable.SelectEnumerableAsyncIterator`2.MoveNextCore(CancellationToken cancellationToken) in D:\a\1\s\Ix.NET\Source\System.Interactive.Async\Select.cs:line 106
at System.Linq.AsyncEnumerable.AsyncIterator`1.MoveNext(CancellationToken cancellationToken) in D:\a\1\s\Ix.NET\Source\System.Interactive.Async\AsyncIterator.cs:line 98
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.MoveNext(CancellationToken cancellationToken)
ClientConnectionId:c2e0bafa-b323-4e64-809c-64ec7927b4ce
Error Number:134,State:1,Class:15
Exploring logs indicates the following as the problematic query:
Executing DbCommand [Parameters=[@___job_0_Id='586a534e-45e2-4e5f-b9ae-a9f300938aba', @___job_0_Id='586a534e-45e2-4e5f-b9ae-a9f300938aba'], CommandType='Text', CommandTimeout='30']
SELECT [row].[Id], [row].[Created], [row].[CreatedBy], [row].[Error], [row].[FailedAttemptCount], [row].[Finished], [row].[InputDocument], [row].[LastHeartbeat], [row].[NotBefore], [row].[OutputDocument], [row].[ParentId], [row].[PredecessorId], [row].[RowVersion], [row].[State], [row].[Title], [row].[Type], [row].[Id], [row].[Version_Build], [row].[Version_Major], [row].[Version_Minor], [row].[Version_Revision], [row].[Id], [row].[RetryPolicy_MaxAttemptDuration], [row].[RetryPolicy_MaxRetryCount]
FROM [Job] AS [row]
WHERE [row].[Id] IN (
SELECT [row0].[FromId]
FROM [JobGraph] AS [row0]
WHERE ([row0].[ToId] = @___job_0_Id) AND ([row0].[FromId] <> @___job_0_Id)
)
Indeed, two parameters with the same name (and value) are listed.
I paste here more log entries relevant to the case:
Currently unable to prepare a repro app but I hope the log entries paint a picture of what is happening. If necessary, I can try make a repro app next week.
Further technical details
EF Core version: 2.2.2
Database Provider: Microsoft.EntityFrameworkCore.SqlServer
Operating system: Windows 10 1809
IDE: VS 15.9.5
The text was updated successfully, but these errors were encountered:
Changing my code to compare by the foreign key instead of the navigation property seems to act as a workaround - the variable duplication disappears in this case.
I unexpectedly received the exception:
Exploring logs indicates the following as the problematic query:
Indeed, two parameters with the same name (and value) are listed.
I paste here more log entries relevant to the case:
I believe this is the code in question that I use for my query:
What do I need to do to get my query to work?
Possibly related: #12871
Currently unable to prepare a repro app but I hope the log entries paint a picture of what is happening. If necessary, I can try make a repro app next week.
Further technical details
EF Core version: 2.2.2
Database Provider: Microsoft.EntityFrameworkCore.SqlServer
Operating system: Windows 10 1809
IDE: VS 15.9.5
The text was updated successfully, but these errors were encountered: