NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

unable to unload sequence file which has got sequencecall step types

Hi All,
I have got the follwing error when try to release the sequencefile. The Sequence file has got SequenceCall type steps.
The error is
 
" Unable to unload sequence file becasuse it is in use, possibly because it is executing"
 
 
My code looks like
 

for(int nSeqIndex = 0; nSeqIndex < numSeq; nSeqIndex++)

{

m_ObjSeq = m_ObjSeqFile->GetSequence(nSeqIndex);

int nNumSteps = m_ObjSeq ->GetNumSteps(StepGroups::StepGroup_Main);

for(int nStepIndex = 0; nStepIndex < nNumSteps; nStepIndex++)

{

m_ObjStep = m_ObjSeq ->GetStep(nStepIndex, StepGroups::StepGroup_Main);

if (m_ObjStep ->IsSequenceCall)

{

SequenceCallModule ^objm = (SequenceCallModule^)m_ObjStep ->Module;

stepSeqFile1 = m_ObjEngine ->GetSequenceFile(objm ->SequenceFilePath,

GetSeqFileOptions::GetSeqFile_FindFile);

bool bTempReleasedFlag = false;

while(bTempReleasedFlag == false)

{

try

{

bTempReleasedFlag = m_ObjEngine->ReleaseSequenceFileEx

(stepSeqFile1, ReleaseSeqFileOptions::ReleaseSeqFile_UnloadFile);

// |

//ReleaseSeqFileOptions::ReleaseSeqFile_DoNotRunUnloadCallback);

if(bTempReleasedFlag)

stepSeqFile1 =

nullptr;

}

catch (Exception ^ex)

{

MessageBox::Show(ex->Message,ex->Source);

}

}

}

//End of IF

}

//Step For loop

}

//Sequence For loop

m_ObjEngine->UnloadAllModules();

bool bReleasedFlag1 = false;

while(bReleasedFlag1 == false)

{

try

{

 

bReleasedFlag1 = m_ObjEngine->ReleaseSequenceFileEx

(m_ObjSeqFile, ReleaseSeqFileOptions::ReleaseSeqFile_UnloadFile);

//   Here I am Always get false result

//ReleaseSeqFileOptions::ReleaseSeqFile_DoNotRunUnloadCallback);

}

catch (Exception ^ex)

{

bool valu2 = m_ObjSeqFile->UnloadModules();

MessageBox::Show(valu2.ToString());

MessageBox::Show(ex->Message,ex->Source);

}

}

regards
RKK
0 Kudos
Message 1 of 10
(4,396 Views)

Hi rkk,

I would think you have to release your object such as the Step object (m_ObjStep), the Adapter object (objm) and the Sequence object (m_ObjSeq) by setting to nothing before you can release the sequence file.

Regards

Ray Farmer

Regards
Ray Farmer
0 Kudos
Message 2 of 10
(4,395 Views)

Hi,

From where did you get "m_ObjSeqFile" do you obtain it from GetSequenceFileEx?

What is the result of m_ObjSeqFile.IsExecuting(), if you call this before your failure occurs?

Is it possible to post the complete source code that allows opening the hole stuff  in an IDE?

Greetings

Juergen 

 

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 3 of 10
(4,386 Views)

Thank you for u r reply.

m_objSeqFile object initialized by using

"GetSequenceFileEx" method. Yes, I am checking for whether file is executing using method "IsExecuting()" and it returns "False".

I modified the code as given bellow

f

(m_ObjSeqFile->HasModel)

{

m_ObjSeqFile->ModelOption = ModelOptions::ModelOption_NoModel;

m_ObjSeqFile->ModelPath =

nullptr;

}

m_ObjSeqFile->UnloadCallbackEnabled =

false;

m_ObjSeqFile->UnloadModules();

m_ObjEngine->UnloadAllModules();

m_objPropertyObj =

nullptr;

m_ObjSeq =

nullptr;

bool bReleasedFlag1 = false;

while(bReleasedFlag1 == false)

{

try

{

bReleasedFlag1 = m_ObjEngine->ReleaseSequenceFileEx

(m_ObjSeqFile, ReleaseSeqFileOptions::ReleaseSeqFile_DoNotRunUnloadCallback);

// | here it returns "true". If I provide ReleaseSeqFile_UnloadFile option then it returns always "FALSE".

//ReleaseSeqFileOptions::ReleaseSeqFile_DoNotRunUnloadCallback);

}

catch (Exception ^ex)

{

/*bool valu2 = m_ObjSeqFile->UnloadModules();

MessageBox::Show(valu2.ToString());

MessageBox::Show(ex->Message,ex->Source);*/

}

}

m_objPropertyObj =

nullptr;

m_ObjSeq =

nullptr;

m_ObjSeqFile =

nullptr;

m_ObjExe =

nullptr;

//m_ObjEngine = nullptr;

GC::Collect();

GC::WaitForPendingFinalizers();

Thank you

Regards

RKK

0 Kudos
Message 4 of 10
(4,369 Views)

Hi rkk

I have written a small C# exe that uses GetSequenceFileEx and ReleaseSequnceFileEx with RleaseSeqFile_UnloadFile

it works with my Testseq.seq.  you can also load other Seqfiles.

Also check the state CanUnload.
Why do you use option ReleaseSeqFile_UnloadFile ? and Why not ReleaseSeqFile_NoOptions

Greetings

Juergen

 

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 5 of 10
(4,362 Views)
Thanks for reply.
I have problem like when execute step , the type is "Sequence Call". The step displays the dotnet window and waits for the I/P value.
The problem is it works for first time and from second time onwards it's kind of hang mode, but other steps will execute. The problem is in second time I am not able to enter the value. The process what I did was as follows:
 
1) Get the main sequence file (Base file which calls other sequence file through step "Sequece call")
2) Loop through the number of steps
   2.1) Check for step type as "SequenceCall"
      2.1.1) Get the "SequenceCallModule"
      2.1.2) Get the sequence file object using module object
      2.1.3) Get the Execution object using method New Execution
      2.1.4) Get the Thread object, context objects and get the results
      2.1.5 ) Release the sequence file
3) Release the base sequence file
 
Please can you provide on example does the same thing( i.e execute sequence call step which calls DOTNET form and so on).
Regards
RKK
 
 
 
0 Kudos
Message 6 of 10
(4,357 Views)
Hi Rkk,
 
A German proverb: "Ich kann den Wald vor lauter Bäumen nicht sehen!" (I can not see the forrest because there are to many trees)
OK. Thats little bit to much for me at the moment.
For more investigation I need a sample SequnceFile and the source codes from you.
Put all together in a ZIP-file post in here.
 
So i can took my chainsaw to see forest Smiley Wink
 
Greetings
 
Juergen
 
 
 
 
 
 
--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 7 of 10
(4,348 Views)
rkk,

Are you creating an execution with interactive args? How are you waiting for the execution to complete? Is your code itself inside an execution (i.e. in a step's code module)? Which sequence file are you having trouble unloading? The "base" or the other one or both?

Also, there might be a much simpler way to do what you are trying to do. If you provide more details we might be able to help.

-Doug


Message Edited by dug9000 on 03-19-2008 10:32 AM
0 Kudos
Message 8 of 10
(4,338 Views)
Hi,
The trouble in unloading other sequence files. Please refer the attached code for u r better understanding.
Waiting for Execution complete using

value = TSth1->WaitForEnd(-1,

true, nullptr, nullptr);

After completion of this I tried to unload Other sequence file. But unfortunately it's not happening.

Yes, i.e. in a step's code module.

Regards

RKK

0 Kudos
Message 9 of 10
(4,326 Views)
Are you possibly using that same sequence file in the sequence that's running your step whose code module is starting the new execution? Have you tried using teststand steps to implement what you are trying to do instead of a code module (I'd suggest using a Sequence call with the new execution option and dynamic loading and unloading as that would be a more straightforward way to accomplish what you are trying to do without getting into all the low level details of the API)?

Can you attach a sequence and code that reproduces the problem? Without code and a sequence to show us exactly what you are doing it will be hard to follow and figure out what the problem is. There is no known issue with being unable to load sequence files related to sequence calls, and I'm not completely following your explanation of what you are doing, so the easiest way for us to understand would be to attach an example that reproduces the problem.

Hope this helps,
-Doug
0 Kudos
Message 10 of 10
(4,310 Views)