8

Since updating Windows 10 to 1803, I have begun receiving this error anytime I run an EF query that joins against a table-valued function that takes in a scalar parameter.

Message: The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 2 (""): Data type 0x00 is unknown.

Stack Trace: at System.Data.SqlClient.SqlCommand.<>c.b__180_0(Task1 result) at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke() at System.Threading.Tasks.Task.Execute() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.d__c.MoveNext()

I am using Entity Framework v6.2 in .NET 4.6 framework projects. I verified that the same code executes without a problem on another computer using Windows 10 1709. I updated the computer to Windows 10 1803 with no other change, and I started getting the error above. Code causing the error:

var query = from fs in db.ViewWithInformation
            join e in db.GetEventsForPerson(personnelId) on fs.Event_Id equals e.Event_Id
            where !fs.Is_Deleted
            select fs;
return await query.ToArrayAsync();

If I remove the join against db.GetEventsForPerson, the query runs. The SQL generated by the EF query above runs fine in SSMS.

Edit 5/15/2018: I have confirmed that this is specifically caused by .NET Framework 4.7.2. I manaully installed .NET 4.7.2 on my Windows 10 1709 computer, and the error started up again.

divega
  • 6,320
  • 1
  • 31
  • 31
Zach Green
  • 3,421
  • 4
  • 29
  • 32
  • I have the exact same issue, the same code works on Windows 7. I've tried many different things but still can't get it working. One way I did manage to get it working is to use non async methods – DotnetShadow May 15 '18 at 07:02
  • 1
    I've opened up a ticket on GitHub and referenced this issue on there:https://github.com/aspnet/EntityFramework6/issues/537 – DotnetShadow May 15 '18 at 07:11
  • Thanks for helping confirm that I am not crazy. Good to know about the async part. I did a system restore back to 1709 on my main work PC, and I am back in operation. – Zach Green May 15 '18 at 12:39
  • 1
    An update - Engineers have developed a SQL DB server side fix and are rolling out through the safe deployment procedure. ETA 24-48 hours. – Joyce Lee May 19 '18 at 17:21

5 Answers5

8

My name is Peter Carlin and I work in the SQL Server team. I first want to apologize for this incident and the impact on users of .NET Framework 4.7.2. I next want to explain what happened and how Microsoft is fixing it in more detail.

The issues is due to improvements to the Always Encrypted functionality in SQL. These improvements expand the set of operations that can be done in Always Encrypted, however they are not yet ready for applications to use. These improvements involve changes to both SqlClient and SQL server side. We introduced an error in .NET Framework 4.7.2 such that in some circumstances (related to MARS) SqlClient incorrectly thinks the added functionality is in use and sends invalid requests to SQL. SQL rejects those with the error messages seen in this thread. This only happens if connected to a SQL server that has support for the added functionality as well. SQL DB is the first to get the latest SQL changes, and recently deployed the added functionality.

Our immediate fix is to ensure the SQL DB acts as if it does not have the added functionality, so the SqlClient side bug in 4.7.2 is not encountered. This is why we are able to fix the issue with a SQL DB side change.

We are working as quickly as wise/safe to deploy, validate, the fix. At this point the fix is deployed to approximately 10% of our production capacity, with expected completion by Monday May 21st.

  • Thanks for the quick response. I have verified that this has fixed all of the SQL Azure servers to which I connect. – Zach Green May 21 '18 at 22:56
3

We are investigating this as a possible regression on SqlClient on .NET Framework. Anyone that can provide a repro project, pelase post it at https://github.com/Microsoft/dotnet/issues/749.

divega
  • 6,320
  • 1
  • 31
  • 31
  • So far I have only been able to recreate it using the EDMX for my database. A repro project pointed at a much simpler EDMX hasn't thrown the error. I am still trying to simplify a copy of my EDMX until the error stops. – Zach Green May 16 '18 at 13:17
2

Temp Workaround: Per ChainbridgeTech change MultipleActiveResultSets from TRUE to FALSE in my connection string, and the error stops.

This has been reported and is being worked on. They still need a repro and I'm still working on isolating shareable data that I can make public:

https://github.com/Microsoft/dotnet/issues/749

Duplicate issue of TDS Error on Azure Entity Framework SQL Calls after Windows 10 April 2018 Update

RyanCEI
  • 426
  • 2
  • 7
1

Microsoft is actively looking at this issue. Based on what we know so far, the issue is related to .NET framework 4.7.2 with MARS (Multiple Active Result Sets) when using async/await.

Known workarounds include rolling back the Windows/.NET framework update, not using MARS or not using async/await.

If you have additional information that can help us to narrow it down, please add to the issue report at https://github.com/Microsoft/dotnet/issues/749

Tomas Talius
  • 71
  • 1
  • 2
  • 2
    An update - based on our investigation only Azure SQL DB customers are impacted. We plan to have a fix deployed on Azure SQL DB service side in about 24 hrs. In the mean time, the work arounds mentioned above are valid (rollback update, disable MARS or remove async/await). – Tomas Talius May 18 '18 at 23:41
0

The solution for me was to convert the query that was dying from using .Include to .IncludeOptimized and it now works.

Demodave
  • 6,242
  • 6
  • 43
  • 58