Error 1057 Occurred at To More Specific Class While Using an X Control in a PPL

Updated Dec 13, 2023

Reported In

Software

  • LabVIEW
  • LabVIEW Application Builder Module

Issue Details

In my application I am casting a Front Panel Control to an X Control using the To More Specific Class primitive. When I pack my code into a Packed Project Library and run it from the PPL, I get an error stating:

Error 1057 occurred at To More Specific Class at an unidentified location

Possible reason(s):

LabVIEW:  Type mismatch: Object cannot be cast to the specified type.


How do I prevent this error from occurring?

Solution

You can avoid this error by explicitly including the X Control in the Support Directory in the Application Builder Build Specification.
  1. Create a new Build Specification for a Packed Project Library in your LabVIEW Project
  2. Select the Destinations category.
  3. Choose a Destination path for the Support Directory. The default is fine.
  4. Select the Source File Settings category.
  5. Select the X Control from the Project Files tree. Note: the X Control must be in the project but not in the top level library of the build specification.
  6. Choose Support Directory from the Destination drop-down menu.
  7. Continue configuring the Build Specification as normal

Additional Information

The X Control must not be included in the library that will be built into a Packed Project Library. It does not need to be included in the Always Included section.

Error 1057 is not specific to X Controls and can occur with many different classes.