Add repro test and fix for abstract method override calling base property in polymorphic base query#314
Open
mikevmil wants to merge 3 commits intohazzik:mainfrom
Open
Add repro test and fix for abstract method override calling base property in polymorphic base query#314mikevmil wants to merge 3 commits intohazzik:mainfrom
mikevmil wants to merge 3 commits intohazzik:mainfrom
Conversation
added 3 commits
February 19, 2026 17:27
…polymorphic base query
Introduce AlignInstanceToDeclaringType to ensure the instance used in method and property calls matches the method's declaring type.
Author
|
I've added code that removes the unnecessary cast, thus the test that I've written is now passing. |
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.
Hi hazzik,
This PR adds a minimal repro test for a bug I’m hitting when using DelegateDecompiler with EF in a polymorphic query scenario.
What the test covers
In this setup, projecting the abstract method (implemented in the derived type) causes the query translation/decompilation to fail as I get the following error:
When I look deeper, it seems like it tries to cast LivingBeein/Animal to Dog/HoneyBee when retrieving the value of the base class, which fails within Entity Framework and shouldn't even be needed considering (in my case) I'm using TPH.
I’m opening this PR primarily to contribute a repeatable, automated repro that documents the exact scenario and prevent possible regressions once a fix is found.
If someone familiar with the decompiler/EF translation path can point me at where this cast is being introduced, or provide a fix, I’d really appreciate the help/guidance.