LabVIEW 2020 Compiler Bug When Switching Between Targets

Updated Oct 26, 2023

Reported In

Software

  • LabVIEW

Issue Details

I have a VI that uses the 1D String Array to Delimited String VI. When I run the VI in a Real-Time target, the output returns data as expected. However, when I run the VI back in the Windows target, the output shows an extra return character (\r) at the end. It seems like the LabVIEW compiler is not switching correctly between Real-Time and Windows OS.

Solution

LabVIEW is constant-folding and caching the 'String Length' of the 'End of Line Constant ', which should be platform dependent (\r\n vs. \n). This means if the VI compiles and executes first on the cRIO, it will correctly determine length = 1 (\n). Then if the same VI is moved and executed on Windows, LabVIEW will incorrectly use the cached length (1) instead of the correct length = 2 (\r\n)

This is a known issue in LabVIEW 2020 and was fixed in the 2021 version. There are several options or workarounds to fix this issue:
  • Enable the 'Separate compiled code from source file' in the VI properties for the 1D String Array to Delimited String VI.
  • Fully deploying the code to the Real-Time target by using Build and Run as Startup. This will cause a true full compile and skips any problems with the compiler cache.
  • Use LabVIEW 2021 to run the code in which the bug was fixed.