Author Topic: "The path is not of a legal form" error  (Read 528 times)

sramirez

  • Newbie
  • *
  • Posts: 18
    • View Profile
"The path is not of a legal form" error
« on: July 21, 2023, 08:02:57 AM »
I have a tag that I am trying to read with AdvancedHMIDrivers.EthernetIPforCLXCom.  It is a valid tag but I get the error "The path is not of a legal form".

Here is the crazy thing, it was working and then I did a Build in VS2019 and started getting this error.

I thought I had a corrupted Visual Studio project file so I created a new project and copied the code over to the new project.  The .Read(tagname) command worked for a while.  I did multiple builds and after a few hours the new project stopped working with the "The path is not of a legal form" error.  I have no idea what to do.

Any guidance would be great.

bachphi

  • Hero Member
  • *****
  • Posts: 642
    • View Profile
Re: "The path is not of a legal form" error
« Reply #1 on: July 21, 2023, 08:52:22 AM »
I don't have a crystal ball, a little more info would be helpful, copy the code or screenshot...
May be checking for an extra space in the path.
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: "The path is not of a legal form" error
« Reply #2 on: July 21, 2023, 09:09:58 AM »
I have a tag that I am trying to read with AdvancedHMIDrivers.EthernetIPforCLXCom.  It is a valid tag but I get the error "The path is not of a legal form".
Is that the exact error? I tried searching the error list in AdvabcedHMI, and do not find that. A more common error is "Path Segment Error"

sramirez

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: "The path is not of a legal form" error
« Reply #3 on: July 21, 2023, 09:55:01 AM »
The code is as follows

Dim _EthernetCommsMain As New AdvancedHMIDrivers.EthernetIPforCLXCom
        With _EthernetCommsMain
            .IPAddress = IPAddress
            .PollRateOverride = 1000
            .ProcessorSlot = 0
        End With
Dim val as string = _EthernetCommsMain.Read("RFID_Security.AOI_RFID.To_App_Reset_Request")  <--- Error happens on this line.

The path to the tag is valid.  I have tested this path with another application to make sure it was valid.

The error returned by VS2019 is attached.

Thanks for any assistance.
"The path is not of a legal form" is the exact error message I receive.
I am running AdvancedHMIv3.9.9.25.38

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: "The path is not of a legal form" error
« Reply #4 on: July 21, 2023, 10:07:42 AM »
Can you scroll the error to the right so I can see the end of the Stack Trace

bachphi

  • Hero Member
  • *****
  • Posts: 642
    • View Profile
Re: "The path is not of a legal form" error
« Reply #5 on: July 21, 2023, 12:11:13 PM »
Is '.To_App_Reset_Request' a custom string?

Is 'RFID_Security' UDT a Safety class or Standard? and is it set for External Access= Read/Write?

 I may see a problem here:  'RFID_Security' is a UDT. Normally we can have another UDT below it,  but it appears in this case,  that 'AOI_RFID' is an AOI, not a sub UDT, hence their tags are local access.

Can  you export the UDT and AOI, I can test it out.
« Last Edit: July 21, 2023, 12:32:04 PM by bachphi »
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================

dmroeder

  • Global Moderator
  • Full Member
  • *****
  • Posts: 206
    • View Profile
Re: "The path is not of a legal form" error
« Reply #6 on: July 21, 2023, 12:32:03 PM »
That error sounds more like a visual studio thing rather than something coming from the driver.

sramirez, if you change it to read a simple DINT, does it produce the same error?

sramirez

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: "The path is not of a legal form" error
« Reply #7 on: July 21, 2023, 01:07:29 PM »
Thank you for the responses.

RFID_Security.AOI_RFID.To_App_Reset_Request is a BOOL type

Here is the entire stack trace

   at MfgControl.AdvancedHMI.Drivers.EthernetIPforCLX.BeginRead(String startAddress, Int32 numberOfElements)
   at MfgControl.AdvancedHMI.Drivers.EthernetIPforCLX.Read(String startAddress, Int32 numberOfElements)
   at MfgControl.AdvancedHMI.Drivers.DriverBase.Read(String startAddress)
   at hdPLC.uiPLC.ReadProgramTag(String ProgramName, String Tag) in C:\git\Framework\FrameWork_Libraries\hdPLC\uiPLC.vb:line 235

I have attached the UDT for bachphi.

I would agree it appears to be a VS2019 thing because I can run the exact same block of code in another application and it works fine.  I just have no idea where to go from here!

sramirez

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: "The path is not of a legal form" error
« Reply #8 on: July 21, 2023, 03:20:02 PM »
I believe I found the source of the problem but it makes no sense to me.

If I run my application in debug mode with a command line parameter I get the error.
If I don't run a command line parameter the path passed to .Read() works as expected.

Example:
RemakePart.exe 17165  in debug mode, Dim val as string = _EthernetCommsMain.Read("RFID_Security.AOI_RFID.To_App_Reset_Request")  produces the error.

RemakePart.exe  in debug mode - no error, read PLC's path and returns the expected value.

Open CMD.exe and run RemakePart.exe 17165 from the same bits/folder - works as expected.

I am not sure what to make of this but I wanted to share what I found.

Thanks,
Shawn R