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

DB query is executed with the parameters of the previous query #7115

Closed
linnando opened this issue Nov 23, 2016 · 6 comments
Closed

DB query is executed with the parameters of the previous query #7115

linnando opened this issue Nov 23, 2016 · 6 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

@linnando
Copy link

Steps to reproduce

Minimal solution: https://github.com/linnando/EFCoreTest

Model.cs contains the description of the model copied from https://docs.microsoft.com/en-us/ef/core/index

To reproduce the bug:

  1. Execute tests in Deployment.cs (they will apply migrations and seed the test data).
  2. Execute tests in MainTest.cs. Each of two tests queries the database twice. After each query, the count of found records is written to the debug trace. The first query looks for a blog with url "test" (which exists in the database) and the second one --- for a blog with url "wrong_url" (which does not). So, the expected output is 1 and 0 (in each test).

The issue

TestGetByQueryableUrl outputs 1 and 1 instead of expected 1 and 0. In the debug mode, I see that in both cases, the same query is sent to the database: "SELECT COUNT(*) FROM [Blogs] AS [blog] WHERE [blog].[Url] IN (N'test')". Although in the second time another parameter "wrong_url" is given, the query is still sent to the database with parameter "test" instead (probably, somehow cached from the previous query).

In contrast, TestGetByEnumerableUrl works correctly (sends correct queries and outputs 1 and 0), although it differs from the first test only in the signature of the auxiliary method (GetBlogsByEnumerableUrl).

Further technical details

EF Core version: 1.1.0
Operating system: Windows 10 Enterprise N
Visual Studio version: VS Enterprise 2015 (14.0.25431.01 Update 3)

@divega divega added this to the 1.1.1 milestone Nov 24, 2016
@divega
Copy link
Contributor

divega commented Nov 24, 2016

Assigning this to @anpete for investigation in the 1.1.1 milestone based on the potential severity. We can discuss it next time we triage.

anpete added a commit that referenced this issue Nov 28, 2016
…query

- Fixes an issue in ExpressionEqualityComparer where we would incorrectly determine equality for constant EnumerableQuery nodes.
@anpete anpete added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Nov 29, 2016
@anpete anpete closed this as completed Nov 29, 2016
@divega
Copy link
Contributor

divega commented Jan 12, 2017

@anpete was this fixed pushed to the 1.1.1 branch? Should we reopen the issue?

@anpete anpete reopened this Jan 12, 2017
@anpete
Copy link
Contributor

anpete commented Jan 12, 2017

Yep, re-opened.

@Eilon
Copy link
Member

Eilon commented Jan 19, 2017

This patch bug is approved. Please use the normal code review process w/ a PR and make sure the fix is in the correct branch, then close the bug and mark it as done.

@divega
Copy link
Contributor

divega commented Jan 22, 2017

@anpete closing again since the fix is in and approved for the patch. Please reopen if necessary.

@divega divega closed this as completed Jan 22, 2017
@smitpatel
Copy link
Member

✅ Verified

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

5 participants