The command terminated unexpectedly

Problem

You receive an error message stating "The command terminated unexpectedly; An unexpected error has occurred and the command has terminated.  If this error continues to occur then it may be necessary to restart Revit or possibly the computer" every time you select any of the Xrev Transmit buttons in all versions of Revit.  You've tried updating Revit and are running the latest release of Xrev Transmit.  The logs show that both the Revit add-in and the background process are starting up ok, however, WCF is unable to find the endpoint.

Solution

It is possible that another application unintentionally (but very effectively) blocks communication between some parts of Xrev Transmit.

Xrev Transmit uses a background process to host the UI (for various reasons, including to avoid limitations imposed by Revit) and we use Windows Communication Foundation (WCF, a part of Microsoft's .NET Framework) to communicate between the background process and the add-in running inside the Revit process over named pipes.  

This could happen if there is another process on the machine that creates a named pipe with elevated privileges for an endpoint at net.pipe://localhost/ (or net.pipe://+/). This really isn't good practice - a developer shouldn't use such a general address or assume that their application is the only one using named pipes on the PC. We use named pipes created with non-elevated privileges named net.pipe://localhost/<PID>/TransmitApplicationService for the background process and net.pipe://localhost/<PID>/TransmitRevitService for the add-in running inside the Revit process. In this situation, the WCF framework is unable to find our endpoints.

For another user the issue was caused by an application called NCentral by Solarwinds. Are you using this? If so, try disabling the NCentral service - this resolved the issue a user.  We also had another user experience this issue and it seemed to be related to some Logitech and McAfee processes.

There is a tool called Process Explorer (https://docs.microsoft.com/en-us/sysinternals/downloads/process-explorer) which will allow you to run a search to find processes that are using a given pipe. This should help to quickly find which programs may be causing the issue.

Find processes that are using a named pipe.

  1. Once you download Process Explorer, extract the zip file's contents to a folder somewhere.  You should end up with the following files:
  2. Run procexp64.exe, then go to Find > File Handle or DLL...

  3. Enter "\Device\NamedPipe\" as the search term and click Search:

    The search may take a while, but you should end up with a long list of results

  4. Click the Name column header to sort by pipe name

    From the screenshot above, we need to check the 4 processes at the top where the pipe name matches the search term exactly

  5. Check each of these processes in Process Explorer's main window.  You can left click a search result to have Process Explorer navigate directly to that process in it's main window and highlight the relevant handle in the bottom pane (although I've found that Process Explorer often crashes when doing this before the search has finished).

    If you find the process manually, be sure to match using it's name and PID
From the list of processes with a handle to this pipe, look for one that may have been recently installed / updated since the last time Xrev Transmit worked on this machine.  Note that the problem occurs when a process has created this pipe with elevated privileges.  This means that the process serving that pipe may be running in a different session, or may have been configured to run with elevated privileges.
Please let us know how you go with this.  If you're able to identify the application that's causing the problem then we can contact the vendor and ask them to change how they use this pipe.

Related articles