Bug in SQL Server provider when using UTF8 collations
See original GitHub issueI’ve encountered exceptions when using EF with SQL Server and configuring
- the database and all column collations to be a UTF8 collation and
- all columns to use
varchar
rather thannvarchar
(as one should with UTF8 collations on SQL Server, somewhat counter-intuitively).
I’ve been doing this for a while now without obvious issues, but in a project that does some massive import of larger text portions some of the inserts fail with an exception:
SqlException: The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 7 ("@p8"): Data type 0xA7 has an invalid data length or metadata length.
This does not happen with the traditional nvarchar
type, and it happens only in some (thankfully reproducible) circumstances.
I have reduced my import to a test case. See instructions to reproduce there.
Version information
SQL Server version: Microsoft SQL Server Developer (64-bit) 16.0.1050.5 on Windows EF Core version: 6.0.16 Database provider: Microsoft.EntityFrameworkCore.SqlServer Target framework: .NET 6.0 Operating system: Windows 11 IDE: Visual Studio 2022 17.5.2
Issue Analytics
- State:
- Created 4 months ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Collation and Unicode support - SQL Server
Learn about collation and Unicode support in SQL Server. ... Collations that are used with character data types, such as char and varchar, ......
Read more >cannot resolve collation conflict UTF-8 and Ascii
right-click/properties (SSMS 18.9.2) on database in SQL Server ... I notice that the error COLLATE using "AI" and your database according to ...
Read more >Native UTF-8 Support in SQL Server 2019: Savior or False ...
Here are some issues that you might run into when using a UTF-8 Collation at either the Instance level or Database level. These...
Read more >"Invalid data for UTF8-encoded characters" exception in ...
The column is set to varchar , with the database collation set to Latin1_General_100_CI_AS_SC_UTF8. Any idea what's going, or if a workaround is ......
Read more >SQLServer DB is using a collation which is not case sensitive
When trying to migrate the HSQLDB to SQL Server the following message can be seen on the page: The database is not using...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Make sure you got the right branch.
I am able to reproduce the issue. with the repro. I will get back to you on this.