Aspects, EnableableComponents and WithPresent do not work together

Moving from a query that makes use of WithPresent

foreach (var comp in SystemAPI.Query<RefRO<ComponentOne>>()
                         .WithAll<EnableableComponentOne>()
                         .WithPresent<EnableableComponentTwo>())
{
...
}

to using an aspect:

public readonly partial struct ProblemAspect : IAspect
{
    private readonly RefRO<ComponentOne> _comp1;
    private readonly EnabledRefRO<EnableableComponentTwo> _isEnabled;
   
    public ComponentOne Comp1 => _comp1.ValueRO;
    public bool IsEnabled => _isEnabled.ValueRO;
}
foreach (var comp in SystemAPI.Query<ProblemAspect>()
                         .WithAll<EnableableComponentOne>()
                         .WithPresent<EnableableComponentTwo>())
{
...
}

fails, complaining that:

EntityQueryDescValidationException: EntityQuery contains a filter with duplicate component type name EnableableComponentTwo.  Queries can only contain a single component of a given type in a filter

I have tried using the Optional attribute instead of the WithPresent, but the Optional attribute is not supported on EnabledRefRO fields.

public readonly partial struct ProblemAspect : IAspect
{
    private readonly RefRO<ComponentOne> _comp1;
    [Optional]
    private readonly EnabledRefRO<EnableableComponentTwo> _isEnabled;
   
    public ComponentOne Comp1 => _comp1.ValueRO;
    public bool IsEnabled => _isEnabled.IsValid && _isEnabled.ValueRO;
}

foreach (var comp in SystemAPI.Query<ProblemAspect>()
                         .WithAll<EnableableComponentOne>())
{
...
}

I have tried using RefRO instead and relying on IsValid, but that is always true, regardless of the enabled state. It would also be a hack if it worked.

public readonly partial struct ProblemAspect : IAspect
{
    private readonly RefRO<ComponentOne> _comp1;
    [Optional]
    private readonly RefRO<EnableableComponentTwo> _isEnabled;
   
    public ComponentOne Comp1 => _comp1.ValueRO;
    public bool IsEnabled => _isEnabled.IsValid;
}

foreach (var comp in SystemAPI.Query<ProblemAspect>()
                         .WithAll<EnableableComponentOne>())
{
...
}

So it seems it is not possible to get a reference to an enableable component’s enabled state when you want it to match regardless of it being true or false.

Of course it is possible to detach the enableable component from the Aspect and have it on its own, but that only works if no logic internal to the aspect relies on it.

public readonly partial struct ProblemAspect : IAspect
{
    private readonly RefRO<ComponentOne> _comp1;
    [Optional]
    private readonly RefRO<EnableableComponentTwo> _isEnabled;
   
    public ComponentOne Comp1 => _comp1.ValueRO;
    public bool IsEnabled => _isEnabled.IsValid;
}
foreach (var (aspect, enabled) in SystemAPI.Query<ProblemAspect, EnabledRefRO<EnableableComponentTwo>>()
                         .WithAll<EnableableComponentOne>()
                        .WithPresent<EnableableComponentTwo>())
{
...
}