Unsolved
This post is more than 5 years old
12 Posts
0
2108
May 3rd, 2011 13:00
xam/object in use error
I am using the XAMSDK with a .NET application. When the application begins I create an XLibrary and XSystem instance without a "using" statement. I then run a query (using the query example from the TestHarness) that displays all the XSet XUID's on the XSystem. After the query completes successfully, I close the application at which point I receive an error:
{"Exception of type 'XAMSDK.XAMException' was thrown."}
xam/object in use
Is there something I need to do in my application, prior to closing to avoid this error? Since I am not runnig within a "using" statement wrapped around my code, I should have to clean up xlib and xsys resources but I'm not sure of the proper way with the XAMSDK. I tried xlib.Dispose(), xsys.Dispose(), xlib = Nothing and xsys = Nothing but the error still occurs.
etasigma
12 Posts
0
May 3rd, 2011 13:00
Out of curiosity I went back to the TestHarness application that came with the .NET Wrapper for XAMSDK. I started the application and created 3 XSets with option number 3. I then ran a Query using option number 6 and selecting the blank query option. It ran successfully and returned the 3 XSets I had just created. I then closed the application by not making a choice and hitting "enter". The application blew up with the same error as I am getting in my own application. This error appears to only occur if the query returns with results. A query with no results returned seems to close fine.
gstuartemc
2 Intern
•
417 Posts
0
May 5th, 2011 03:00
Thanks, I'll look at the sample. It is probably related to the underlying file stream not being closed.
DmitriKuznetsoi
14 Posts
0
December 5th, 2011 00:00
Just in case anyone else is wondering what is the problem.
In the XQuery::
ProcessResults() method, there is an XStream that gets created, however it is not closed ! This is the reason why this error is given.
Just surround the part of the code where it is created with try/catch/finally clause, and call
resultStream.Close(); in finally part.
I assume stream is not needed after results are read into the list. So this seems to me a correct way to do.