Bug: Ambiguous call to overloaded method

Funny:

with:

uses
System,
System.Collections.Generic,
System.Web,
System.Text;

method CorrectIsoDate(const Datum : System.String; var Jahr: System.String) : System.String; public;

implementation

method CorrectIsoDate(const Datum : System.String; var Jahr: System.String) : System.String;
begin
result := String.Empty;
Jahr := String.Empty;

if not String.IsNullOrEmpty(Datum) then begin
var splitdate := Datum.split(’-’);
if (splitdate.Length = 3) then begin
Jahr := splitdate[0];
var Monat := splitdate[1];
var Tag := splitdate[2];
if (Tag = ‘00’) and (Monat = ‘00’) then begin
Tag := ‘30’;
Monat := ‘06’;
end
else begin
if (Tag = ‘00’) then
Tag := ‘15’;
if (Monat = ‘00’) then
Monat := ‘06’;
end;
exit Jahr + ‘-’ + Monat + ‘-’ + Tag;
end;
end;
end;

Webapplication, .NET Version 4.5.2, Oxygene 10.0.0.2425

I just had exactly the same error with the following line of code (Cirrus):
if aMethod.Language = Language.Oxygene then

Note: aMethod is of type IMethodDefinition

Hi Theo,

could you resolve it?

Cheers
Marcus

No - was not a big issue, so I didn’t use it.
Your topic was just before I would have made one.

Hmm,. so there’s only one CorrectIsoDate, but it still gives ambiguous overload? Are there any additional messages? can we get a complete test case?

i pasted this into a new project and it compiles clean after fixing broken quit chars and adding the top/bottom

namespace foo;

interface

uses
  System,
System.Collections.Generic,
System.Web,
System.Text;

method CorrectIsoDate(const Datum : System.String; var Jahr: System.String) : System.String; public;

implementation

method CorrectIsoDate(const Datum : System.String; var Jahr: System.String) : System.String;
begin
result := String.Empty;
Jahr := String.Empty;

if not String.IsNullOrEmpty(Datum) then begin
var splitdate := Datum.split('-');
if (splitdate.Length = 3) then begin
Jahr := splitdate[0];
var Monat := splitdate[1];
var Tag := splitdate[2];
if (Tag = '00') and (Monat = '00') then begin
Tag := '30';
Monat := '06';
end
else begin
if (Tag = '00') then
Tag := '15';
if (Monat = '00') then
Monat := '06';
end;
exit Jahr + '-' + Monat + '-' + Tag;
end;
end;
end;

end.

In an aspect implementation, when I use
if aMethod.Language = Language.Oxygene then

I get the same error on aMethod.Language, and I did not program the call as it is in Cirrus.

an actually complete project or code file that compiles (well, except for the error) would really be helpful, coz otherwise I’m just guessing and throwing random code snippets at the compiler in a (usually futile) attempt to reproduce…

Hmmm…,
its a very complex project with many nugets installed plus databases involved.

Can you extract the methods you call, and the call to it? There’s probably more than 1 CorrectIsoDate, and the types of the parameters involved should allow is to reproduce this issue. (the body of the methods can be empty)

No mere than one CorrectIsoDate I renamed it a couple of times with same result.

At the time being it is impossible to help you:

image

Every 2 Minutes I have to restart VS 2015 as it is not working any more (in all my projects)

Seems to be a namespace problem:

method foo(const Beginn: string);
begin
var jahr : String;
var anfang := ODSRestService.GlobalObjects.CorrectIsoDate(Beginn, var jahr);
end;

With:

method foo(const Beginn: string);
begin
var jahr : String;
var anfang := CorrectIsoDate(Beginn, var jahr);
end;

it works (with foo in theGlobalObjects.pas (1.1 KB) same unit)

Even with changing the namespace to foo it does not work from other unit:

WebApplication15.zip (7.5 KB)

this works:

what am I missing?

Cannot work like that, it hangs again:

image

Try to call the method from another unit or even from method foo with full workspace before method call.

Cannot show it as my VS hangs again.

Do you have steps for the hangs? (you’re using latest right?)

Yepp, using 31. New class in new .pas file.
When changing or adding code it hangs up and PC starts noisy cooling.
Happens especially after mistyping.

Any chance you could attach a second copy of Visual Studio as debugger and see if you can get a call stack on what it is stuck on? Does it hang indefinitely, or is it just slow (ie recovers after a few (or many) seconds)?

thanx,
marc

Hi Marc,

sometimes slow (Qeue is busy) sometimes hanging indefinitely.
I am for two weeks in holiday now without PC :slight_smile:
So I am coming back to you if I encounter this problem after my holidays again.
Thanks for your good support

1 Like

Logged bugs://83138 for Theo’s test case, but I dont expect its going to be related tho this one.