Mocking TRttiProperty results in AV
Hi folks,
I am trying to mock TRttiProperty, but the setup fails when I try to mock properties like Name, Visibility or IsReadable and results in an AccessViolation.
I am totally clueless what went wrong. Maybe someone is able to catch what I am doing wrong here, I attached a sample Project using DUnitX (latest master) and DSharp (latest master).
Thanks in advance & Kind Regards, Aleks
Comments (4)
-
Account Deleted -
Account Deleted Using Delphi-Mocks helped me out, there I get an "Abstract Error" because the getters of the properties I tried to mock are abstract (what I did not recognize). Maybe its possible in DSharp to throw such an exception as well?
-
repo owner The issue is that the calculation of how many virtual methods the class has was wrong because all of them are private. Abstract methods can be mocked just fine if they contain RTTI (which is not the case for private and protected methods unless specified otherwise which is not possible for RTL classes unless you recompile them).
There might be a way to make private virtual getters and setters mockable though given they have a "known" signature. But that requires some more investigation.
-
repo owner - changed status to resolved
fixed issue
#23→ <<cset 8f22b8a5c3b3>>
- Log in to comment
Doh .. wasnt logged in. I am using XE7 by the way