Incomprehensible XS1061 error

This forum is meant for questions and discussions about the X# language and tools
Post Reply
ic2
Posts: 1855
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Incomprehensible XS1061 error

Post by ic2 »

I had to make some changes in an older X#/C# DLL used by VO and unfortunately I got the usual array of errors for code which used to work a few X# version back but now not anymore. With some trial and error I could clear out most but I have no idea why this error occurs:

Code: Select all

Error	XS1061	'DotNetLibForVO.WCFService' does not contain a definition for 'remotehttp' and no accessible extension method 'remotehttp' accepting a first argument of type 'DotNetLibForVO.WCFService' could be found (are you missing a using directive or an assembly reference?)
It's in the line of code and 'remotehttp', which is not found according to the error, is a member of an enum which shows both as tooltip and via Peek definition (on WCFConnectionType). The Enum was in another .prg but moving it did not clear the error. Nor did a complete solution clear & rebuild. See also the picture:
WCFConnectionType.jpg

Code: Select all

service := WCFConnectionType:Get_Channel(WCFConnectionType.remotehttp, cRemoteAdr)
How can I get rid this formerly non existing error?

One small other thing - I did solve it but makes me wonder why this could only be done with with right mouse, Properties on the project, Language then Allow Dot for instance members

Code: Select all

nRowCount:=oRange:Rows.Count
gives Error XS9112 Can't access the instance member 'Microsoft.Office.Interop.Excel.Range.Count' with the DOT operator '.'.

but

Code: Select all

nRowCount:=oRange.Rows.Count
gives Error XS0118 'oRange' is a variable but is used like a type

I should be able to get this compiling either way, without compiler options, I'd say?

Dick
User avatar
robert
Posts: 4465
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Re: Incomprehensible XS1061 error

Post by robert »

Dick,

You mention
an older X#/C# DL
I don't understand that. The DLL is either X# or C#.

You are not showing all the code. But in the code that you show I see that you have a local or field with the name "WCFConnectionType".
Most likely, the compiler finds both the local/field and the enum and gets confused.
You can solve that by writing

Code: Select all

service := WCFConnectionType:Get_Channel(DotNetLibForVO.WCFConnectionType.remotehttp, cRemoteAdr)

Btw the line

Code: Select all

nRowCount:=oRange.Rows.Count
will only compile if you have enabled the "Allow Dot for instance members" option, because Rows is an instance property of oRange, and Count is an instance property of the Rows collection.





Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
ic2
Posts: 1855
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Re: Incomprehensible XS1061 error

Post by ic2 »

Hello Robert,
robert wrote: Tue Oct 01, 2024 8:25 pm I don't understand that. The DLL is either X# or C#.
It's one solution with a few X# projects included and 1 C# project. That compiles to one DLL.That I find one of the advantages of .Net, that you can easily mix languages.
robert wrote: Tue Oct 01, 2024 8:25 pm You are not showing all the code. But in the code that you show I see that you have a local or field with the name "WCFConnectionType".
Most likely, the compiler finds both the local/field and the enum and gets confused.
You can solve that by writing

Code: Select all

service := WCFConnectionType:Get_Channel(DotNetLibForVO.WCFConnectionType.remotehttp, cRemoteAdr)
Indeed! I totally overlooked the fact that I assigned WCFService() to a local with the same name. No idea why (it's derived from C# code years ago) but your solution solves it, thanks a lot! Apparently earlier X# versions did make the right WCFConnectionType choice coincidentally (probably just with a warning).
robert wrote: Tue Oct 01, 2024 8:25 pm Btw the line

Code: Select all

nRowCount:=oRange.Rows.Count
will only compile if you have enabled the "Allow Dot for instance members" option, because Rows is an instance property of oRange, and Count is an instance property of the Rows collection.
It works well with this compiler option; I understand from your answer that I could do without, should I wish so, by breaking this line up in 2 different lines.

Dick



Robert
[/quote]
FFF
Posts: 1568
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

Re: Incomprehensible XS1061 error

Post by FFF »

ic2 wrote: Wed Oct 02, 2024 9:51 am It works well with this compiler option; I understand from your answer that I could do without, should I wish so, by breaking this line up in 2 different lines.
AFAIS, no need for breaking. Replacing both dots with colons should do it.
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
ic2
Posts: 1855
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Re: Incomprehensible XS1061 error

Post by ic2 »

Hello Karl,

Indeed, nRowCount:=oRange:Rows:Count works without the setting, thanks.

Often it's a bit of VO (or maybe Vulcan) created code with or without something more in this program. So instead of thinking what I am looking at (instance property etc) and what I should use I let the compiler decide for me ;)

Dick
FFF
Posts: 1568
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

Re: Incomprehensible XS1061 error

Post by FFF »

Yeah - reading isn't guaranteed to equal understanding, what one has read :)
(Otherwise round, similiar - i know, there's a thing "class variable" - but can't remember how this works and seem to be unable to find the right thing to use as search in the help...)
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
User avatar
Chris
Posts: 4826
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: Incomprehensible XS1061 error

Post by Chris »

Hi Karl,

"Class variable" is another name for STATIC fields of a class (STATIC EXPORT, STATIC PROTECT etc). Also STATIC METHOD is often referred to as "class function".
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
FFF
Posts: 1568
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

Re: Incomprehensible XS1061 error

Post by FFF »

"Static" - that was the key i needed, thank you!
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Post Reply