#1 2022-02-10 11:31:29

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 506

C0000005 in mormot.soa.core 64Bit

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

#2 2022-02-10 11:36:40

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: C0000005 in mormot.soa.core 64Bit

When does it happen?

MethodsCount should never be 0 I guess.

Offline

#3 2022-02-10 11:39:19

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 506

Re: C0000005 in mormot.soa.core 64Bit

In my Case its 0


Rad Studio 12.1 Santorini

Offline

#4 2022-02-10 11:47:54

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 506

Re: C0000005 in mormot.soa.core 64Bit

I wrote a derived Class from TInterfaceFactory which does not evaluate the Methods...


Rad Studio 12.1 Santorini

Offline

#5 2022-02-10 12:19:12

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: C0000005 in mormot.soa.core 64Bit

So you broke the code expectations.

Please check https://github.com/synopse/mORMot2/commit/b55f3504
It should fix your problem.

Offline

Board footer

Powered by FluxBB