DATA AHEAD toolkit support Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

XLR8 : Another .NET memory leak ? Error 1172

Hi,

 

My LabVIEW program is writing approximately 20 cells to an Excel file via XLR8 around every 30 seconds.  After approximately 40 minutes the following normally happens...

 

  • LabVIEW closes completely
  • The Excel file is corrupt and cannot be opened with Excel
  • A .bak file is created automatically (I'm not sure how this is created).

If I rename the .bak file to .xlsx it opens normally with Excel, so the backup file is not corrupted.

 

Sometimes LabVIEW does not crash and XLR8 generates the following error...

 

"Error 1172 occurred at Invoke Node System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.

                Inner Exception: System.NullReferenceException: Object reference not set to an instance of an object."

 

I am running LabVIEW base version 15 and XLR8 v2018.3.0.7

 

Any help or suggestions on resolving this issue would be greatly appreciated.

 

Thank you very much

Aaron

0 Kudos
Message 1 of 5
(3,866 Views)

Update.

 

My code initially opens an Excel template and saves it to a new path and filename using a modified version of the example vi "exmpl_WR_template_results.vi".

 

I noticed that the file refs between opening the template file and closing the template file are different (the Refs is changed by the 'Save Workbook.vi').  Please see probes 6 and 7 on the attached screen shot.

 

Is this correct ?  Should the 'Open Create Workbook' Refs Out be connected to the 'Close Workbook' Refs In ?

 

Thank you very much

Aaron

0 Kudos
Message 2 of 5
(3,847 Views)

UPDATE :

 

I have discovered the 'Refs Out' WBK field from the 'Open Create Workbook.vi' is sometimes zero even though the file exists and has been opened successfully by a previous call to the 'Open Create Workbook.vi'.

 

My Excel file is saved on a VeraCript drive.  Could this cause a problem ?

 

Thank you.

Aaron

0 Kudos
Message 3 of 5
(3,830 Views)

Hi Aaron,

 

as stated in https://forums.ni.com/t5/DATA-AHEAD-toolkit-support/XLR8-Which-Refs-to-use-for-Close-Workbook-when-u... the VI "Save Workbook.vi" will close the changed template file and after that re-open the new file again. So the change of Refnums is expected.

 

I am not familiar with VeraCrypt Drives but it might be possible that the creation of the file on such a encrypted drive takes a little bit longer and hence the re-opening of the new file results in an error and empty refnums.

 

A solution to your problem might be another approach:

Why not copy your your template excel-file to the new file-name, using basic LabVIEW-functions, and then open that copied file, write to it and close and save it with just a call of "Close Workbook.vi".


Regards,

DATA AHEAD

 

 

Kudos are welcome...
0 Kudos
Message 4 of 5
(3,821 Views)

Hi Jens,

 

Thanks for your reply and suggestion.  I have a work around for now, I'm not sure which of the following helps but most likely is the change from an encrypted to un-encrypted drive...

 

  1. Changed file locations from an encrypted to an un-encrypted drive
  2. Ensured all template file cells are un-locked
  3. Ensured all template sheets are un-protected
  4. Removed all graphs from the template file.
  5. Added 3 retries and 1 second delay between them when the 'Open Create Workbook.vi' returns zero in 'Refs Out' WBK field.

Best regards

Aaron

0 Kudos
Message 5 of 5
(3,817 Views)