09-17-2013 03:59 AM
I am using Labview 2012 on Windows XP. I am writing an application where i want to have some custom error handling. When i try to update the error cluster to induce an error programetically in one of the VI's (To do this, I use the bundle by name block, wire the incoming error cluster which has no error, the set the status to True and the code to 500X, and a description for the error), the application terminates with the error popup as expected.
However this is immediately followed by a Access Violation exception which causes Labview to Shut down.
In the VI, if i generate an error normally (For example trying to create a TDMS file by specifing an invalid path), the application terminates with the error message but i do not see the access violation exception.
Just a note, currently i am running the App out of the the Project Explorer. I am yet to try to build an exe and see if i run into the same issue but i still would like to find out the root cause. I have used the "Contonous Logging and Acquistion" sample project which comes with Labview 2012 as a base for my application. I have made few code changes over this.
Thanks in advance for the help & replies. The NI community rocks.
09-17-2013 04:05 AM
@DsouzaAbel wrote:
[...]the set the status to True and the code to 500X, and a description for the error), [...]
The string field in the error cluster contains the information "where does the error occur", not "what the error is". Because of that, this field is labeled "source".
That being said, custom errors recommend to define error text files with the description of the error. Did you generate this file? If so, where did you place it?
You normally create an error file using Tools >> Advanced >> Edit Error Codes .
The error ring is also an option.
Norbert
09-17-2013 04:42 AM
Hey Norbert, Thanks for your reply.
Yes i have the source field set up correctly. I have attached the vi.
I would need a few details on the file for defining custom errors. I used Tools >> Advanced >> Edit Error Codes to generate a new error file. I added this file to the project. Now i am confused if i need to link this file to the "C:\Program Files\National Instruments\LabVIEW 2012\vi.lib\Utility\error.llb\Error Code Database.vi"
Basically for setting a custom error, I pass in the error code to the attached VI. The aim is to retrive the error description using the "Error Code Database.vi" and append this description with the call chain details (which forms the source of for the error cluster).
Thanks in advance.
Abel.
09-17-2013 06:19 AM
Abel,
as i said, it is not recommended to include information about the error in the source string at all.
Reason is that LV automatically looks up the error code to display the "reason" using the error text files.
As you renamed your error text file to not include the "-errors.txt" ending and you have put it into the wrong directory.
Search the LV help for "Defining Custom Error Codes to Distribute throughout Your Application" for further information on custom error messages.
Also, review the link "distribute the file" in this help section as it explains how to supply this file together with the EXE.
hope this helps,
Norbert
09-18-2013 05:26 AM
Thanks Norbert. The links were very helpful.
I tried this out and it seems very convinent but still not completely discarded the approach of having a txt file with error strings and codes since we need support for multiple languages/ Procucts variants. So the thought being we can have different sections for each product and one txt file for each language.
So once the currently selected language & product is known (May be through registry settings), we can open the Error file for the particular language, identify the section for the selected product & then display the string based on the code passed in.
Would you have any suggestions in this regard? I am still searching how this stuff in handled in LV, so any pointers would be very helpful.
Ok, so back to the initial problem. After the Application terminates when i close the main vi, there is an access violation causing Labview to crash.
The thing is i am running the application from the project explorer by running the startup vi. When an error is generated (TDMS File Open error by specifying an incorrect path), the error message is displayed and the VI terminates. I can run the vi (Startup VI for the Application) multiple times and each time it terminates but when i attempt to close the vi, it throws the access violation.
Attaching the dump file & WinDbg Output. Any pointers would be of great help.
Best Regards,
Abel.
09-18-2013 06:35 AM
Abel,
so can you confirm that the user has to perform specific steps in order for the access violation to occur?
Is it always connected to such a TDMS error situation?
Norbert
09-18-2013 08:26 AM
Not specific to TDMS, basically any error. I tried by manually inducing a custom error and i still see the access violation.
09-18-2013 08:37 AM
Abel,
does the crash occur always?
The goal of this question is to track if there are dependencies of the crash to certain VIs/functions.
Norbert
PS: I had an issue in the past after updating LV but using an "old" LabVIEW.ini (which i copied from the old version). LabVIEW reported an error during shutdown all the time (even if i didn;t load any VIs!). After re-creating the ini, everything was OK.
09-19-2013 01:56 AM
Hey Nobert,
Well i havent explored a lot if this access violation will occur from different parts of the application. So far i tried inducing error in one lib of the application and there seems to be this crash all the time. Initially i thought it was only for Custom Errors but i get the crash even with a system generated errors (The TDMS error).
On my machine i had a Runtime engines for Labview 8.6 & 2009 installed but not the Development Environment. I have now installed labview 2012 for developing this application. However i would like to try re-creating the ini. Could you plese let me know how to do this?
Thanks,
Abel.
09-19-2013 03:57 AM
OK, so i debugged this a bit more & here is my finding.
The Application performs calls to some dll functions. This is mainly to setup a session and acquire network data. Without any app errors things are fine. In the error case, the app terminates but the access violation shows up when the vi is closed. I commented out all the dll interactions, generated an error which caused the app to terminate and then upon closing the vi there was no access violation.
Hmmm so that tells me its related to the dll (Loading & unloading of the dll probably. I read that the dll gets unloaded when the vi that loaded it is closed, does the vi not do this in case of errors?).
However i have not found any way to unload a dll from labview. I did go through this post "http://digital.ni.com/public.nsf/allkb/77594203D78D12278625729100758BE5" but this approach wont work for me as i have multiple vi's performing data acquisition from the dll once the session is started.
Regards,
Abel.