dotnet / efcore

EF Core is a modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations.
https://docs.microsoft.com/ef/
MIT License
13.8k stars 3.19k forks source link

Apostrophe symbol in SQL Server column description is scaffolded as ' #34714

Open janseris opened 2 months ago

janseris commented 2 months ago

description on SQL Server column: Filename under which map data are saved when cached on user's machine.

Generated C# XML documentation on the property: Filename under which map data are saved when cached on user's machine.

Expected result: Filename under which map data are saved when cached on user's machine.

EF Core version: 7 Database provider: Microsoft.EntityFrameworkCore.SqlServer Target framework: .NET 8 Operating system: Win11 IDE: Visual Studio 2022 17.11

roji commented 2 months ago

XML documentation is, well, XML, and &apos; is a valid representation of the character in XML. EF must escape the string it reads from the description; for example, if your column description contains a < character, it must escaped or it will result in invalid XML. There may be a way to instruct the escaping to not escape when it's not strictly necessary (like in the apostrophe case), I'm not sure.

ErikEJ commented 2 months ago

@janseris Does the description not look correct in your editor / intellisense?

janseris commented 2 months ago

XML documentation is, well, XML, and &apos; is a valid representation of the character in XML. EF must escape the string it reads from the description; for example, if your column description contains a < character, it must escaped or it will result in invalid XML. There may be a way to instruct the escaping to not escape when it's not strictly necessary (like in the apostrophe case), I'm not sure.

Hi thank you well yes some symbols like ' are not necessary to be escaped in Visual Studio because they work even though not escaped. True that for >symbol the escaping is required because that would be malformed XML. @ErikEJ it looks correctly but only on mouseover and not in the generated text.

So the overall issue is actually something like: Symbols which do not form malformed XML documentation in Visual Studio do not need to be escaped in generated XML documentation

ErikEJ commented 2 months ago

Sounds like a non-issue to me.

janseris commented 2 months ago

It's more like a nice to have feature so that the generated text is more human readable for symbols which do not need to be escaped as @roji states. Current: obrazek Proposed: obrazek

roji commented 2 months ago

Putting on the backlog and assigning to @cincuranet (scaffolding).