LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

"Project or Library file is corrupt" when trying to open XControl

This is not a question, this is an account of my learning experience that I hope saves you from throwing your monitor through the wall.

 

When trying to open an XControl, I received the following error: "Project or Library file is corrupt"

 

CorruptXControl.png

 

Knowing Projects/Classes/XControls are all XML files, I opened the XControl using Notepad++ to see what was going on. The file structure is somewhat intuitive, and you'll be able to recognize many components of your library.

 

I used a binary search approach to find the offending XML by deleting all of the virtual folders, then seeing if the XControl would open. It did, meaning the headers of the XML were fine. Then I took the original file again, and deleted half the virtual folders to see if it would open, and it did not, meaning the offending XML was in a virtual folder I had not deleted that round. I took the original file, and deleted the other half of virtual folders, and it opened. I took the original file, and deleted only one virtual folder, and it opened. Aha! that virtual folder had only 5 items, and I knew one of the items must be the culprit.

 

Anyway, it only took about 10 minutes to narrow it down to an item that had a duplicate entry, two lines that were exactly the same:

 

DuplicateEntryInLibrary.png

 

After I deleted the duplicate item, the XControl opened up just fine! No data loss, no corruption.

 

How did the item get duplicated? Beats me. Could have been the product of a crash, some of my notorious renaming shenanigans, who knows.

 

Lessons learned:

 

  1. Version Control (Source Code Control) is a hero, as usual.
  2. Try poking around with the XML if you get corrupt libraries - it may be an easy fix, but your mileage may vary.
  3. Don't even think about #2 unless you have #1 "under control"
Action Item for Applications Engineer: could you point this error to the Owning Developer? I would suggest this type of an error fail more gracefully, or at least with more information. Possibly, this type of error could self-correct silently since it's so easy to diagnose? Watching the library tank due to a benign issue nearly cost me a monitor and a monitor-sized area worth of sheetrock damage. Smiley Mad ( Smiley Very Happy )
Message 1 of 1
(2,651 Views)