You are not logged in.
Pages: 1
Hi Arnaud,
today i got an exception in this method:
My Bugfix is here: can you pls add it to repo
function TServiceContainer.AddServiceInternal(aService: TServiceFactory): PtrInt;
var
MethodIndex: integer;
procedure AddOne(const aInterfaceDotMethodName: RawUtf8);
var
p: PServiceContainerInterfaceMethod;
begin
p := fInterfaceMethods.AddUniqueName(aInterfaceDotMethodName);
p^.InterfaceService := aService;
p^.InterfaceMethodIndex := MethodIndex;
inc(MethodIndex);
end;
var
aUri: RawUtf8;
internal: TServiceInternalMethod;
m: PtrInt;
begin
if (self = nil) or
(aService = nil) then
raise EServiceException.CreateUtf8(
'%.AddServiceInternal(%)', [self, aService]);
// add TServiceFactory to the internal list
if ExpectMangledUri then
aUri := aService.fInterfaceMangledUri
else
aUri := aService.fInterfaceUri;
PServiceContainerInterface(fInterfaces.AddUniqueName(aUri, @result))^.
Service := aService;
// add associated methods - first SERVICE_PSEUDO_METHOD[], then from interface
aUri := aUri + '.';
MethodIndex := 0;
for internal := Low(internal) to High(internal) do
AddOne(aUri + SERVICE_PSEUDO_METHOD[internal]);
// BUGFIX here
for m := 0 to (integer(aService.fInterface.MethodsCount)-1) do /// <<<---- Wrong Subtraction MethodsCount is Cardinal and mc-1 is also cardinal.
AddOne(aUri + aService.fInterface.Methods[m].Uri);
end;
Rad Studio 12.1 Santorini
Offline
In my Case its 0
Rad Studio 12.1 Santorini
Offline
I wrote a derived Class from TInterfaceFactory which does not evaluate the Methods...
Rad Studio 12.1 Santorini
Offline
So you broke the code expectations.
Please check https://github.com/synopse/mORMot2/commit/b55f3504
It should fix your problem.
Offline
Pages: 1