Strange Acces Memory Exeption

Hi,

I'm debugging a client and server with separated IDE execution. I call a server method that returns a class and stop the server execution on a break point inside the method(program reset). I dont get a acces violation expetion(just the "could not perform WinHttp operation") on the client side, but if do the same with a method that returns a string I get the could not perform WinHttp operation exception and then Access violation exception.

I have found that this is caused on the following:
procedure TValue.ExtractRawData(ABuffer: Pointer);
var
inlineSize: Integer;
begin
inlineSize := GetInlineSize(FTypeInfo);
if inlineSize = 0 then
raise EInvalidCast.CreateRes(@SInvalidCast);
if inlineSize > 0 then
Move(FAsUByte, ABuffer^, inlineSize)
else
FValueData.ExtractRawData(ABuffer); <<<- Exception because FVAlueData is nil
end;

procedure TMethodImplementation.TParamLoc.SetArg(AFrame: PInterceptFrame;
const Value: TValue);
begin
if (FTypeInfo <> nil) and (Value.TypeInfo <> FTypeInfo) then
Value.Cast(FTypeInfo).ExtractRawData(GetArgLoc(AFrame)) <<<-- this line is called when server method returns a class
else
Value.ExtractRawData(GetArgLoc(AFrame)); <<<-- this is called when server method returns a string
end;

Any hints,

Thanks in advance,

Omar Zelaya

I'd ask you provide steps to reproduce the issue without debugging. There are lots of things that might be influencing when debugging involved - watches, for example.

I tried to simulate the error with the following project attached, but was not successful. What I did was to put a Sleep(50000) in the method implementation. This way, after I call the method from the client, I have time to go to Windows Task Manager and finalize the server app - which I hoped would be similar to a "Terminate" operation from debug.

No strange error happened. Of course, the client raised can error, but a normal error saying something went wrong, and that's it.

Please let me know, thanks.

test-xdata-av-string.zip (13.7 KB)