You are not logged in.
Pages: 1
---------------------------
Debugger Exception Notification
---------------------------
Project RestProtocol.exe raised exception class EInterfaceFactoryException with message 'TInterfaceFactoryRTTI.Create: TCounters record too small in IServerMonitor.PerformanceCounters method Items parameter'.
---------------------------
Break Continue Help
---------------------------
type
TCounters = record
MemoryUsage: Integer;
ThreadsCount: integer;
end;
IServerMonitor = interface(IInvokable)
['{592BF05B-ACA3-434B-8675-B2B498E7DD2D}']
function PerformanceCounters(out Items: TCounters): TResponse;
end;
implementation
initialization
TInterfaceFactory.RegisterInterfaces([TypeInfo(IServerMonitor)]);
end.
Whats am I doing wrong?
Offline
I've added fake field to record
type
TCounters = record
MemoryUsage: Integer;
ThreadsCount: integer;
fake: string;
end;
and it worked.
Strange behavior.
Offline
I guess, the problem was that your first record didn't contain any managed type field: https://synopse.info/forum/viewtopic.ph … 223#p31223
Offline
Yes, this is a compiler limitation.
The easiest workaround is to define two out parameters, MemoryUsage and ThreadsCount.
If you really want to have the JSON with two fields, then use a variant field, and manual _ObjFast() serialization.
Offline
Pages: 1