Error "Could not call proc" with interface method

Hello,

We are registering some methods from an interface using such code:

  with CL.AddInterface(CL.FindInterface('IInterface'),ISampleInterface, 'IISampleInterface') do
  begin
    RegisterMethod('function GetErrorCount : integer', cdRegister);
  end;

When calling the method “MyInterface.GetErrorCount” (“MyInterface” ist of type “ISampleInterface” and is assigned at that moment) we sometimes get an error “Could not call proc”. Sometimes means that the call normally is successfull but (looks like) randomly it fails with this error message. We were not able to find out the difference between a successful call and al call that fails yet.

Do you have any hint what could cause this error message?

Thanks in advance,
Ralf

The only thing I can think of is when you call it on a null reference