Skip to content

Edmx and Microsoft.Data.SqlClient result in HierarchyId invalid error #2020

@cveld

Description

@cveld

Describe the bug

In order to integrate the model first edmx entity framework 6 experience with Microsoft.Data.SqlClient we changed the value of the Provider attribute on the Schema element to Microsoft.Data.SqlClient. As per the instructions on https://github.com/ErikEJ/EntityFramework6PowerTools/blob/community/src/ErikEJ.EntityFramework.SqlServer/readme.md

But now the designer reports the following error:

<File Unknown>(167,34) : error 0005: The 'PrimitiveTypeKind' attribute is invalid - The value 'HierarchyId' is invalid according to its datatype 'http://schemas.microsoft.com/ado/2006/04/edm/providermanifest:TPrimitiveTypeKind' - The Enumeration constraint failed.

<File Unknown>(167,10) : error 0122: The value 'HierarchyId' is not a valid PrimitiveTypeKind.    ConsoleApp1    C:\work\git\ConsoleApp1\Model.edmx    7    

Tested with .NET Framework 4.8.
Package version 5.1.1.

This error isn't blocking the designer, but whenever we do any database operations through the user experience, this error is blocking the process.

To reproduce

You can clone the following solution: https://github.com/cveld/sqlclient-hierarchyid-edmx-designer-error
Open up the solution file in Visual Studio and then double click the edmx file in order to kick off the designer. You will see the reported error message in the error list dialog.

Expected behavior

The error shouldn't be present and the database features should be working as designed.

Further technical details

Microsoft.Data.SqlClient version: 5.1.1
.NET target: Framework 4.8
SQL Server version: Azure Sql Database
Operating system: Windows 11
Visual Studio: 17.5.4

Additional information

We initially reported the issue to ErikEJ/EntityFramework6PowerTools#124 but @ErikEJ does not have any visibility or responsibility towards the Visual Studio side of things.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions