IMD SolutionComputing LibraryShop main store

Troubleshooting

Why the IRC5 PC SDK DeleteQueue example fails to compile

Other computing topics Published 4 min read By IMD Solution engineering team

Short answer

The printed example fails because it calls QueueId, a method the Ipc object does not expose; the documented lookup is GetQueueId, which takes the queue name as a string and returns the integer queue identifier. Call GetQueueId with the queue name, guard with Exists on the returned identifier, and delete with that same identifier.

On this page
  1. Why the printed example fails to compile
  2. The three calls and their arguments
  3. Corrected sequence for the RABQueue deletion example
  4. Checks before you delete an IPC queue
  5. Creating your own queue to receive messages
  6. When the correction is not enough
  7. Questions asked

The DeleteQueue example in the PC SDK application manual for the IRC5 controller does not compile as printed, because it calls a method the Ipc object does not expose: the queue lookup is named GetQueueId, not QueueId. The vendor has confirmed the printed example is a documentation fault and that the manual will be corrected. The fix is one changed call with two consequences around it: resolve the queue name with GetQueueId, keep the Exists guard on the integer identifier that call returns, and pass that same identifier to DeleteQueue. Nothing on the controller or in your SDK installation has to change.

Why the printed example fails to compile #

The compiler error names the method, so the instinct is to debug the queue name. The name is not the problem. As printed, the example reads:

Controller c = new Controller();
int queueId = c.Ipc.QueueId("RABQueue");
if (c.Ipc.Exists(queueId))
    c.Ipc.DeleteQueue(queueId);

The Ipc interface exposes the lookup as GetQueueId(string name): it takes the queue name as a string and returns the queue identifier as an int. QueueId is not one of its members, so the lookup line cannot bind and the build stops there. Because the vendor has acknowledged the fault, the printed spelling is not evidence of an alternative lookup API. Changing the queue name, the controller address or the queue capacity does not make that line compile; only the method name does.

The three calls and their arguments #

Call Argument Role
GetQueueId the queue name, as a string resolves the name to the integer queue identifier
Exists the identifier GetQueueId returned true only while that queue exists on the controller
DeleteQueue that same identifier removes the queue the identifier refers to

Keep one identifier from lookup through deletion: every later call consumes the value GetQueueId produced, and substituting any other number breaks the link between the queue the code checked and the queue it removed.

Corrected sequence for the RABQueue deletion example #

Inputs, and where each comes from:

  • The queue name RABQueue, the queue the printed example deletes. Substitute the queue your own application owns.
  • A connected controller object, constructed as the example shows with new Controller().
  • The lookup signature: GetQueueId takes the queue name as a string and returns the identifier as an int, so the receiving variable is an int.

The rule in words: resolve the queue name to its identifier once, test that identifier with Exists, and call DeleteQueue with it only when the test passes.

Controller c = new Controller();
int queueId = c.Ipc.GetQueueId("RABQueue");
if (c.Ipc.Exists(queueId))
{
    c.Ipc.DeleteQueue(queueId);
}

Line by line: the first line gives a controller connection; the second resolves the string name into the int queueId; the third tests that identifier; the fourth runs only when the test passed. The build is the test: this sequence compiles because every member named exists on Ipc, and the deletion keeps the guard the printed example intended.

Decision: if this still fails to build on your machine, the suspect is the PC SDK assembly your project references, not the queue name — check that reference and the API documentation for the release you build against. If it builds, the correction is complete and what remains is operational, covered below.

Checks before you delete an IPC queue #

  • Match the queue name against the code that creates it; in the example that name is RABQueue.
  • Resolve the name through the controller connection your application actually uses.
  • Keep lookup, existence test and deletion on the identifier GetQueueId returned; do not substitute an identifier remembered from an earlier run.
  • Guard the deletion with Exists so the call runs only while the queue is present; the manual does not define what DeleteQueue does otherwise.
  • Run the deletion path only where removing the queue is intended: PC-side and robot-side code that still posts to that queue or reads from it loses its message channel when it disappears.

Creating your own queue to receive messages #

The same manual chapter shows the other direction, and its example compiles as printed. It checks an existing queue with Exists, then creates the application's own receive queue: myQueue = c.Ipc.CreateQueue("PC_SDK_Q", 5, Ipc.IPC_MAXMSGSIZE);. That queue is named PC_SDK_Q, holds up to 5 messages, and takes its per-message size from the IPC_MAXMSGSIZE constant. The argument order is the documented one: name, capacity, message size.

A receive queue that compiles but fills at runtime is a different fault. When IPC queues overflow while trap routines keep posting, the usual cause is trap interrupts that never return, and the repair sequence is in Fixing IRC5 IPC queue full errors from trap interrupts.

When the correction is not enough #

Two failure modes remain after the rename, and each has its own decision:

  • The build still fails with GetQueueId unresolved: inspect the PC SDK assembly the project references and use the signature its API documentation shows for your installed release. Do not put the printed spelling back to force a build.
  • Deletion behaves unexpectedly at runtime: stop the deletion path, confirm with the owners of the producing and consuming code that the queue is meant to be removed, and re-check the lifecycle behavior in your release's API documentation before retrying.

One caution belongs here: exercise queue deletion on a controller where removing that queue is harmless before running it against a cell in operation.

Questions asked

Does the QueueId mistake mean the controller or the SDK needs a patch?

No. The fault is in the manual's example text only. The vendor confirmed the example shall call GetQueueId and that the manual will be corrected, so no controller firmware change and no SDK reinstall are involved. You write the lookup the documented way and rebuild your project.

Can the Exists call take the queue name instead of the identifier?

The application manual shows Exists used both ways: with a queue name string when it checks an existing queue before creating another, and with the looked-up identifier in the deletion example. For deletion, keep the guard on the identifier your GetQueueId call returned, which is how the corrected example is meant to read.

A method named QueueId resolves in my project. Is that the documented lookup?

It is not the controller IPC lookup the example meant. If something named QueueId compiles for you, it is coming from your own helper code or a different assembly, not from the Ipc members the manual documents. Keep controller queue operations on GetQueueId so the name-to-identifier resolution is the documented one.

What happens if DeleteQueue runs for a queue that no longer exists?

The printed example does not define that behavior, and the corrected sequence is not documented to either. That is why the Exists guard stays in: the deletion call only executes after the existence test returns true. If you remove the guard, you are relying on behavior the documentation does not promise, so keep the guard and handle lookup failures in your own error handling.

Keep reading

  • Troubleshooting

    Fixing IRC5 IPC queue full errors from trap interrupts

    The queue fills because transitions on the interrupt's signal arrive faster than the controller can run the trap. Arm the interrupt with \Single or call ISleep first in the trap, and set an input filter longer than the chatter but shorter than the shortest real pulse; a restart only drains the queue.

    Other computing topics

  • Troubleshooting

    Why an Industrial PC Pings an S7-1500 but Runtime Stays Disconnected

    Ping proves the IP path only. When Runtime shows the S7-1500 disconnected with an unsafe-connection error, make the IE General interface, the Windows adapter and the Runtime connection resolve to the same NIC, make the station name and PROFINET device name match, then trust the certificate in both directions.

    Operating systems on the plant floor

  • Troubleshooting

    Fixing IRMQMessage FlexPendant Interface load error

    The error names a missing controller system option, not a code fault: the virtual controller's system was built without FlexPendant Interface, so the RAPID module is rejected at load and the PC SDK receive path is never tested. Build the virtual system with the option (a backup of the real controller is the reliable source), then debug the IpcQueue exchange only after the module loads.

    Operating systems on the plant floor