Skip to content

Fix issue with runtime resolve on open generic class#198

Merged
PhenX merged 2 commits intomasterfrom
bug-open-generic-class
Apr 2, 2026
Merged

Fix issue with runtime resolve on open generic class#198
PhenX merged 2 commits intomasterfrom
bug-open-generic-class

Conversation

@PhenX
Copy link
Copy Markdown
Member

@PhenX PhenX commented Apr 2, 2026

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a runtime resolution issue in ProjectionExpressionResolver when resolving [Projectable] members on closed generic type instantiations by ensuring parameter-type name generation is based on the member as declared on the generic type definition (matching the source generator’s naming).

Changes:

  • Update runtime reflection-based resolver logic to inspect methods/constructors as declared on the generic type definition when the declaring type is normalized to an open generic definition.
  • Add runtime regression tests that mimic generated expression factory types in the test assembly and validate reflection resolution + resolved lambda signatures.
  • Add/extend generator snapshot coverage for generic-class methods whose parameters are the class type parameter.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
tests/EntityFrameworkCore.Projectables.Tests/Services/ProjectionExpressionResolverGenericTypeTests.cs Adds runtime regression tests and hand-crafted “generated” classes to validate reflection resolution on closed generic types.
tests/EntityFrameworkCore.Projectables.Generator.Tests/GenericTests.GenericClassMethodsWithTypeParameterParameter.verified.txt Adds the verified snapshot for generated output of a generic-class method taking the class type parameter.
tests/EntityFrameworkCore.Projectables.Generator.Tests/GenericTests.cs Adds a generator regression test to exercise generic-class methods with type-parameter parameters.
src/EntityFrameworkCore.Projectables/Services/ProjectionExpressionResolver.cs Adjusts reflection resolver to compute parameter type names from the member on the generic type definition (method/ctor).

@PhenX PhenX merged commit 3b8f603 into master Apr 2, 2026
4 checks passed
github-merge-queue bot pushed a commit to DFE-Digital/teaching-record-system that referenced this pull request Apr 7, 2026
Updated
[EntityFrameworkCore.Projectables](https://github.com/EFNext/EntityFrameworkCore.Projectables)
from 6.0.1 to 6.0.2.

<details>
<summary>Release notes</summary>

_Sourced from [EntityFrameworkCore.Projectables's
releases](https://github.com/EFNext/EntityFrameworkCore.Projectables/releases)._

## 6.0.2

## What's Changed
* Fix issue with runtime resolve on open generic class by @​PhenX in
EFNext/EntityFrameworkCore.Projectables#198


**Full Changelog**:
EFNext/EntityFrameworkCore.Projectables@v6.0.1...v6.0.2

Commits viewable in [compare
view](EFNext/EntityFrameworkCore.Projectables@v6.0.1...v6.0.2).
</details>

[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=EntityFrameworkCore.Projectables&package-manager=nuget&previous-version=6.0.1&new-version=6.0.2)](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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants