Skip to content
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

Stackoverflow in ToQuery method when defining with FromSql #13346

Closed
smitpatel opened this issue Sep 17, 2018 · 2 comments
Closed

Stackoverflow in ToQuery method when defining with FromSql #13346

smitpatel opened this issue Sep 17, 2018 · 2 comments
Assignees
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Milestone

Comments

@smitpatel
Copy link
Member

modelBuilder
 .Query<OrderSummary>()
 .ToQuery(() => Query<OrderSummary>()
     .FromSql(
         @"SELECT o.Amount, p.Name AS ProductName, c.Name AS CustomerName
         FROM Orders o
         INNER JOIN Product p ON o.ProductId = p.Id
         INNER JOIN Customer c ON o.CustomerId = c.Id"));

Above used to work in 2.1 version, we regressed it while fixing #11803

@smitpatel smitpatel self-assigned this Sep 17, 2018
@smitpatel smitpatel added this to the 2.2.0 milestone Sep 17, 2018
smitpatel added a commit that referenced this issue Sep 19, 2018
smitpatel added a commit that referenced this issue Sep 19, 2018
@smitpatel smitpatel added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Sep 19, 2018
smitpatel added a commit that referenced this issue Sep 20, 2018
@ajcvickers
Copy link
Member

Reopening since ToQuery_can_define_in_own_terms_using_FromSql still fails

Microsoft.EntityFrameworkCore.Query.QueryBugsTest.ToQuery_can_define_in_own_terms_using_FromSql

Microsoft.Data.SqlClient.SqlException : Invalid object name 'OrderSummary13346'.
   at Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at Microsoft.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
   at Microsoft.Data.SqlClient.SqlDataReader.get_MetaData()
   at Microsoft.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
   at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean isAsync, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
   at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry, String method)
   at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at Microsoft.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.ExecuteReader()
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReader(RelationalCommandParameterObject parameterObject) in C:\aspnet\EntityFrameworkCore\src\EFCore.Relational\Storage\RelationalCommand.cs:line 400
   at Microsoft.EntityFrameworkCore.Query.RelationalShapedQueryCompilingExpressionVisitor.QueryingEnumerable`1.Enumerator.MoveNext() in C:\aspnet\EntityFrameworkCore\src\EFCore.Relational\Query\Internal\QueryingEnumerable.cs:line 96
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Microsoft.EntityFrameworkCore.Query.QueryBugsTest.ToQuery_can_define_in_own_terms_using_FromSql() in C:\aspnet\EntityFrameworkCore\test\EFCore.SqlServer.FunctionalTests\Query\QueryBugsTest.cs:line 5324

@maumar maumar reopened this Aug 12, 2019
@smitpatel
Copy link
Member Author

Tracked in #16323

@ajcvickers ajcvickers modified the milestones: 2.2.0-preview3, 2.2.0 Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Projects
None yet
Development

No branches or pull requests

3 participants