#1 2022-09-16 14:32:04

udihamudi
Member
Registered: 2022-09-16
Posts: 14

Getting "No variant method call dispatch"

Hello sorry I know its old thread - and I am completely new to Lazarus etc. so I am not even sure this thread is observed, anyhow I seem to have similar issue, the project compiles and starts fine, when I try to use it I get the an error "No variant method call dispatch." any idea where I start debugging it? Also, how can I debug it and see what source file and line the error comes from?

Thanks a lot!!

Offline

#2 2022-09-17 09:35:15

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

Re: Getting "No variant method call dispatch"

Without code to replicate your issue, it is hard to help.

Which version of the FPC compiler do you use?

Offline

#3 2022-09-17 16:08:10

udihamudi
Member
Registered: 2022-09-16
Posts: 14

Re: Getting "No variant method call dispatch"

Thanks for the response! it's fpc 3.2.2.

I have seen an answer to similar issue on the following thread -
https://synopse.info/forum/viewtopic.ph … 187#p38187

But I cannot find a similar value conversion in my code to match the answer to the above thread.

Regretfully it's company code so I am not sure I can share it, but I will ask if I can.

I wish there was a simple way to print the source code line that throws this error but I guess it's not possible from the answers here ....

Offline

#4 2022-09-17 16:46:59

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

Re: Getting "No variant method call dispatch"

Try to reproduce it with a minimal reproductible code...

Otherwise we can not guess what is wrong.

Offline

#5 2022-09-20 13:53:33

udihamudi
Member
Registered: 2022-09-16
Posts: 14

Re: Getting "No variant method call dispatch"

Hi! I managed to narrow down the line that causes the error -
    jItem:=jItems._(numRow);   

Any ideas? maybe need to cast to integer?

/////
In the debugger it shows the following -
000000010009B1F9 488B0598621900           mov rax,[rip+$00196298]

I added breakpoint and the jItems seems to be populated with 5 elements

Last edited by udihamudi (2022-09-20 14:02:51)

Offline

#6 2022-09-20 16:08:08

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

Re: Getting "No variant method call dispatch"

This is due to a bug in FPC RTL, IIRC.
It did not allow a single character name for late-binding.

Try to upgrade to a newer FPC, or use _Safe() instead - which is both faster and safer.

See https://synopse.info/forum/viewtopic.php?id=5894

Offline

#7 2022-09-20 16:21:12

udihamudi
Member
Registered: 2022-09-16
Posts: 14

Re: Getting "No variant method call dispatch"

Thanks!

When I use it I get the following -

    jItem := _Safe(jItems._(numRow));


olirestutils.pas(192,14) Error: Incompatible types: got "PDocVariantData" expected "Variant"

Any ideas...

Offline

#8 2022-09-20 16:22:21

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

Re: Getting "No variant method call dispatch"

Read again the documentation about _Safe().

You need to write something like

 jItem := _Safe(JItems)^.Values[numRow] 

I guess.

Offline

#9 2022-09-20 16:48:43

udihamudi
Member
Registered: 2022-09-16
Posts: 14

Re: Getting "No variant method call dispatch"

Hi,

Sorry it keeps giving me same error, "No variant method call dispatch". Here is the code before this line, that works just fine. I also put breakpoint and I am  getting data back, I see I have data for row 0 ( I get only one row) -

  jData:=_Json(response);

  if (jData._Count=0) or (jData.Name(0)<>'result') then
     exit;

  jItems:=jData.result; 


  jItem := _Safe(jItems)^.Values[0];   // this line still throw the error

Thanks!

Offline

#10 2022-09-20 17:07:48

udihamudi
Member
Registered: 2022-09-16
Posts: 14

Re: Getting "No variant method call dispatch"

NVM I think it passed this line smile now the error is for different line... thanks!!

Offline

#11 2022-09-20 17:39:40

udihamudi
Member
Registered: 2022-09-16
Posts: 14

Re: Getting "No variant method call dispatch"

Ok got it to work, thanks!!!

Another quick unrelated question, I must have clicked the wrong checkbox somewhere smile  the form now takes the full screen and I cannot resize it or close it, any idea what I can do to revert to normal window?

Thanks!

Offline

#12 2022-09-20 17:43:12

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

Re: Getting "No variant method call dispatch"

Which form are you talking about?

Offline

#13 2022-09-20 17:53:23

udihamudi
Member
Registered: 2022-09-16
Posts: 14

Re: Getting "No variant method call dispatch"

The window that the application runs now takes the full screen sad and I cannot resize, close etc.

Last edited by udihamudi (2022-09-20 17:53:57)

Offline

Board footer

Powered by FluxBB