You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Dynamic queries cannot access internal properties even with InternalsVisibleTo #943
When using dynamic queries in System.Linq.Dynamic.Core, I am not able to access internal properties of my entity classes.
Even though I added [assembly: InternalsVisibleTo("DynamicLinqTest")] (or the corresponding consuming assembly name), the dynamic parser still throws an error that the property does not exist.
To Reproduce
Steps to reproduce the behavior:
Create a class with an internal property: public class MyEntity { internal string InternalProp { get; set; } = "test"; }
Add InternalsVisibleTo to the assembly: [assembly: InternalsVisibleTo("DynamicLinqTest")]
Try to query dynamically: var query = entities.AsQueryable().Where("InternalProp == \"test\"");
Observe that it fails with: No property or field 'InternalProp' exists in type 'MyEntity'
Expected behavior
Dynamic query parser should respect InternalsVisibleTo and allow access to internal properties if visibility has been granted.
Additional context
Reflection-based access from the same assembly works fine.
The limitation seems to come from the binding logic inside Dynamic.Core not considering internal properties, even with InternalsVisibleTo applied.
Would it be possible to support this scenario, or at least provide an option to enable it?
Activity
pirumar commentedon Sep 9, 2025
I added this support, but I can't send it by creating a branch due to permissions.
StefH commentedon Sep 9, 2025
You need to fork this repository.
Create a new branch.
And create a Pull Request from your forked branch to this project.
pirumar commentedon Sep 9, 2025
@StefH Sorry, I was distracted, I created the PR correctly.
Add AllowAccessToNonPublicMembers property to ParsingConfig