Profiler Reports EF4 Queries as Occurring in Master - by AjarnMark

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 572246 Comments
Status Closed Workarounds
Type Bug Repros 9
Opened 7/1/2010 1:10:02 PM
Access Restriction Public


Running SQL Server 2008 Profiler to watch the activity of a ASP.NET WebForms application that uses Entity Framework 4...The profiler output lines for the queries indicate that they are occurring in Database ID = 1 / Database Name = Master, but the queries are actually occuring in the application database, not Master.

It does not matter whether the queries are straight LINQ-to-Entities or are EF Functions that call a stored procedure.  Also the login's default database is NOT master, so that is not the problem.

This bug is evident in SQL 2008 SP1 and SQL 2008 R2 RTM.  However, when the database is running on a SQL 2000 SP3a instance, Profiler reports the correct database.
Sign in to post a comment.
Posted by Murray Bryant on 3/30/2011 at 8:25 PM
Please update where we can get this fix.

The workaround is no good for us. We need that setting set to True for our app to work.

Microsoft please give us a way to sort out this problem
Posted by Steve Kumbsky on 3/29/2011 at 10:45 AM
Has this issue been released in a CU? If so, which CU. We are encountering this issue in our traces and would like it resolved.
Posted by Andrew.Schickedanz on 1/27/2011 at 8:38 AM
Can you post the VSTS bug number so we can identify the fix in the next CU?

BTW, I see that file dates for CU 5 which was posted 12/23/2010 are actually 12/11/2010, so I assume we are waiting for CU 6 at this point.
Posted by Eric Kassan on 1/26/2011 at 5:07 PM
When is the "next public cumulative update"? And where will we find it? The old SQL Server home page ( had a link/page for downloads where one could find feature packs, hotfixes, service packs, and other useful downloads, but I can't find it anymore.
Posted by Microsoft on 12/13/2010 at 4:43 PM
Hi AjarnMark,
We have now fixed this issue for next public cumulative update for SQL Server 2008 R2. Thanks again for reporting the issue.

Umachandar, SQL Programmability Team
Posted by Microsoft on 9/19/2010 at 11:24 PM
Hi AjarnMark,

I would like to let you know that the issue you reported has been received by Microsoft SQL Server product team, and we will investigate this issue. If it is reproed, we will consider fixing it in the next release of SQL Server.

Shirley Wang
Microsoft SQL Server Program Manager
Posted by AjarnMark on 7/5/2010 at 11:25 PM
I created a second version of this project and Entity Data Model, this time utilizing stored procedures for selection and updating of data. Similar results were found (see attached file EFProfileUpdateWithSPROC.trc) where the SELECTION stored procedure AND all of the UPDATE stored procedure calls are listed as though they occurred in Master; however I can assure you that these stored procedures do not exist in Master, but rather actually exist in the application database.
Posted by AjarnMark on 7/5/2010 at 10:54 PM
The attached profiler trace file represents another page that was created which loops through a series of Model records and updates the names with a suffix of "-x1". Notice that the SELECT of the records (line 4 SQL:BatchStarting) is listed as occurring in Master. Also notice that the beginning of the updates, the first RPC:Starting (line 8) shows as having occurred in Master, but all the subsequent updates (both RPC:Starting and SP:StmtStarting events) appear in the proper application database (ID=9, name=PhoneStore).