Skip to content

Enabling auto-compiled models on EF 9.0.0-rc.2 causes syntax errors on publish with certain element type mappings #3362

@zotanmew

Description

@zotanmew

I'm testing the new EF Core 9 feature auto-compiled models right now, and have noticed that enabling it causes build failures due to syntax errors in generated code (files suffixed EntityType.g.cs).

Example errors observed:

.../net9.0/EmojiEntityType.g.cs(142,32): error CS1026: ) expected
.../net9.0/AntennaEntityType.g.cs(713,25): error CS1026: ) expected
.../net9.0/EmojiEntityType.g.cs(143,135): error CS1002: ; expected
.../net9.0/AntennaEntityType.g.cs(714,123): error CS1002: ; expected
.../net9.0/AntennaEntityType.g.cs(714,123): error CS1513: } expected
.../net9.0/EmojiEntityType.g.cs(143,135): error CS1513: } expected
.../net9.0/FilterEntityType.g.cs(197,117): error CS1026: ) expected
.../net9.0/FilterEntityType.g.cs(208,27): error CS1002: ; expected
.../net9.0/FilterEntityType.g.cs(208,27): error CS1513: } expected
.../net9.0/OauthAppEntityType.g.cs(327,24): error CS1026: ) expected
.../net9.0/MessagingMessageEntityType.g.cs(331,23): error CS1026: ) expected
.../net9.0/MessagingMessageEntityType.g.cs(332,123): error CS1002: ; expected
.../net9.0/OauthAppEntityType.g.cs(328,137): error CS1002: ; expected
.../net9.0/MessagingMessageEntityType.g.cs(332,123): error CS1513: } expected
.../net9.0/OauthAppEntityType.g.cs(328,137): error CS1513: } expected
.../net9.0/OauthAppEntityType.g.cs(391,23): error CS1026: ) expected
.../net9.0/GalleryPostEntityType.g.cs(236,27): error CS1026: ) expected
.../net9.0/OauthAppEntityType.g.cs(392,125): error CS1002: ; expected
.../net9.0/OauthAppEntityType.g.cs(392,125): error CS1513: } expected
.../net9.0/GalleryPostEntityType.g.cs(237,131): error CS1002: ; expected
.../net9.0/GalleryPostEntityType.g.cs(237,131): error CS1513: } expected
.../net9.0/MetaEntityType.g.cs(141,32): error CS1026: ) expected
.../net9.0/MetaEntityType.g.cs(142,145): error CS1002: ; expected
.../net9.0/GalleryPostEntityType.g.cs(394,24): error CS1026: ) expected
.../net9.0/MetaEntityType.g.cs(142,145): error CS1513: } expected
.../net9.0/GalleryPostEntityType.g.cs(395,121): error CS1002: ; expected
.../net9.0/GalleryPostEntityType.g.cs(395,121): error CS1513: } expected

Affected project/branch: https://iceshrimp.dev/iceshrimp/Iceshrimp.NET/src/branch/wip/net90-optimize2 (error occurs when building the Iceshrimp.Backend subfolder).

I'm not sure whether this is a bug in EF, or a bug with Npgsql. I've tested it against EF versions 9.0.0-rc.2, 9.0.0 (GA), as well as various rtm nightly builds. The issue also occurs against efcore.pg version 9.0.0-rc.2-ci.20241106T153535.

Any input would be greatly appreciated!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions