Fix source generator crash when parameter type uses verbatim @ keyword prefix#208
Merged
Conversation
…ameter type names Agent-Logs-Url: https://github.com/EFNext/EntityFrameworkCore.Projectables/sessions/c8748592-1460-4fb8-bd4d-b8eb20d15ce3 Co-authored-by: PhenX <42170+PhenX@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix source generator failure with entities marked with '@'
Fix source generator crash when parameter type uses verbatim @ keyword prefix
May 16, 2026
PhenX
marked this pull request as ready for review
May 16, 2026 07:04
github-merge-queue Bot
pushed a commit
to DFE-Digital/teaching-record-system
that referenced
this pull request
Jul 22, 2026
Updated [EntityFrameworkCore.Projectables](https://github.com/EFNext/EntityFrameworkCore.Projectables) from 6.0.4 to 6.0.6. <details> <summary>Release notes</summary> _Sourced from [EntityFrameworkCore.Projectables's releases](https://github.com/EFNext/EntityFrameworkCore.Projectables/releases)._ ## 6.0.6 ## What's Changed * Preserve nullable typing for ignored null-conditional access in coalesce expressions by @PhenX with @Copilot in EFNext/EntityFrameworkCore.Projectables#212 * Fix duplicate joins when materializing writable projectables with includes by @PhenX in EFNext/EntityFrameworkCore.Projectables#218 **Full Changelog**: EFNext/EntityFrameworkCore.Projectables@v6.0.5...v6.0.6 ## 6.0.5 ## What's Changed * Fix source generator crash when parameter type uses verbatim @ keyword prefix by @Copilot in EFNext/EntityFrameworkCore.Projectables#208 **Full Changelog**: EFNext/EntityFrameworkCore.Projectables@v6.0.4...v6.0.5 Commits viewable in [compare view](EFNext/EntityFrameworkCore.Projectables@v6.0.4...v6.0.6). </details> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: James Gunn <james@gunn.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Roslyn's
FullyQualifiedFormatincludes the@verbatim escape prefix for types whose names are reserved C# keywords (e.g.global::ProjectName.Storage.@event). This@ended up in the generated hint name, which Roslyn rejects as invalid — causing the generator to silently fail and EF Core to throw at runtime.Root cause
AppendSanitizedTypeNamestrippedglobal::but left@untouched. Since@has no CLR-level meaning (the runtime type name is justevent, not@event), it must be skipped entirely — not replaced — so the generator and the runtime resolver produce identical class names.Changes
ProjectionExpressionClassNameGenerator.AppendSanitizedTypeName— skip@characters in the same pass that skipsglobal::, ensuring the generated class name (and hint/file name) never contains@ProjectionExpressionClassNameGeneratorTests— three new[InlineData]cases coveringglobal::Foo.Storage.@event, bare@event, andglobal::Foo.@delegateExtensionMethodTests— new snapshot test for an extension method whosethisparameter type is@event; verified output usesFoo_EventExtensions_GetId_P0_Foo_event(no@)Example