I am unable to get CodeSite.Send to work with a variable declared as an interface. The compile time error is E2250 There is no overloaded version of 'Send' that can be called with these arguments.
How can I use interfaces with CodeSite?
Code example that demonstrates the problem:
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
end;
IMyInterface = Interface(IInterface)['{9BCD2224-71F8-4CE7-B04C-30703809FAAD}']
function GetMyValue : String;
property MyVaue : String read GetMyValue;
End;
MyType = class(TInterfacedObject, IMyInterface)
private
sValue : string;
function GetMyValue : String;
published
property MyVaue : String read GetMyValue;
end;
var
Form1: TForm1;
test : IMyInterface;
testType : MyType;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
test := MyType.Create;
testType := MyType.Create;
CodeSite.Send( 'testType', testType ); // This compiles
CodeSite.Send( 'test', test ); // Compiler error here
FreeAndNil(test);
end;
function MyType.GetMyValue : String;
begin
Result := Self.sValue;
end;
As Remy pointed out in his comment, CodeSite cannot know what to log when you specify an interface. Even if there were an overloaded Send accepting
IInterface, it would not be of any help as it were still unaware of your specific interfaceIMyInterface.The only workaround known to me is to implement
ICodeSiteCustomDatain your implementing class and use something likeNote that this feature is not available in CodeSite Express.