Migrations do not fully qualify types, resulting in compile errors #25933
Labels
closed-out-of-scope
This is not something that will be fixed/implemented and the issue is closed.
customer-reported
File a bug
dotnet ef migrations add MigrationName
generates code without fully qualified class names when referencing propertiesresulting in CS0104 compiler error in snapshot,migration and
Migration.Designer.cs
. That is happening the moment we have same class name in different namespaces (with same root namespace) see sample code below. This is very inconvenient as the only workaround I found is to rename classes - which result in prefixed names egLabel -> VariantLabel
This looks similar to #25523, however newest preview version of EF Core/EF Core Tools still generates conflicting code in migrations.
As far as I can tell, bug is located here
efcore/src/EFCore.Design/Migrations/Design/CSharpSnapshotGenerator.cs
Line 476 in 85b0670
as
Code.Reference(clrType)
is called withoutfullName
flagInclude your code
Sample project attached TestProject1.zip
Include stack traces
N/A
Include verbose output
Include provider and version information
EF Core version: 5.0.9
EF Tools: both 5.x and 6.x generates invalid code
Database provider: Npgsql.EntityFrameworkCore.PostgreSQL
Target framework: .NET 5.0
Operating system:
IDE: Rider
The text was updated successfully, but these errors were encountered: