Trace.Assert Performing As Expected When Run From The Cluster Manager<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Calibri">Trace.Assert doesn't work as expected when running as a job in cluster manager - Here's a VB.NET code sample that illustrates the problem:</span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Calibri"> </span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><strong><span style="font-size:14pt;font-family:'Courier New'">    <span style="color:navy">Sub</span> Main(<span style="color:navy">ByVal</span> args() <span style="color:navy">As</span> <span style="color:navy">String</span>)</span></strong><span style="font-size:14pt;font-family:'Courier New'"></span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><strong><span style="font-size:14pt;font-family:'Courier New'">        Console.WriteLine(</span></strong><span style="font-size:14pt;color:#a31515;font-family:'Courier New'">&quot;Before assert&quot;</span><strong><span style="font-size:14pt;font-family:'Courier New'">)</span></strong><span style="font-size:14pt;font-family:'Courier New'"></span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><strong><span style="font-size:14pt;font-family:'Courier New'">        Trace.Assert(<span style="color:navy">False</span>)</span></strong><span style="font-size:14pt;font-family:'Courier New'"></span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><strong><span style="font-size:14pt;font-family:'Courier New'">        Console.WriteLine(</span></strong><span style="font-size:14pt;color:#a31515;font-family:'Courier New'">&quot;After assert&quot;</span><strong><span style="font-size:14pt;font-family:'Courier New'">)</span></strong><span style="font-size:14pt;font-family:'Courier New'"></span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><strong><span style="font-size:14pt;font-family:'Courier New'">    <span style="color:navy">End</span> <span style="color:navy">Sub</span></span></strong></p> <p class=MsoNormal style="margin:0in 0in 0pt"><strong><span style="font-size:14pt;color:navy;font-family:'Courier New'"> </span></strong></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Calibri">When logged directly into one of the HPC nodes, if you run the application it prints the first line to the console and then puts up a dialog as expected.  But if the application is run as a task in an HPC job, both lines are written to the console and the assert doesn't have any affect.  Is this behavior expected?</span></p>© 2009 Microsoft Corporation. All rights reserved.Thu, 30 Jul 2009 18:37:41 Z3f4ed814-f63e-4801-a680-21fbb808106chttp://social.microsoft.com/Forums/en-US/windowshpcsched/thread/3f4ed814-f63e-4801-a680-21fbb808106c#3f4ed814-f63e-4801-a680-21fbb808106chttp://social.microsoft.com/Forums/en-US/windowshpcsched/thread/3f4ed814-f63e-4801-a680-21fbb808106c#3f4ed814-f63e-4801-a680-21fbb808106crmaghttp://social.microsoft.com/Profile/en-US/?user=rmagTrace.Assert Performing As Expected When Run From The Cluster Manager<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Calibri">Trace.Assert doesn't work as expected when running as a job in cluster manager - Here's a VB.NET code sample that illustrates the problem:</span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Calibri"> </span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><strong><span style="font-size:14pt;font-family:'Courier New'">    <span style="color:navy">Sub</span> Main(<span style="color:navy">ByVal</span> args() <span style="color:navy">As</span> <span style="color:navy">String</span>)</span></strong><span style="font-size:14pt;font-family:'Courier New'"></span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><strong><span style="font-size:14pt;font-family:'Courier New'">        Console.WriteLine(</span></strong><span style="font-size:14pt;color:#a31515;font-family:'Courier New'">&quot;Before assert&quot;</span><strong><span style="font-size:14pt;font-family:'Courier New'">)</span></strong><span style="font-size:14pt;font-family:'Courier New'"></span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><strong><span style="font-size:14pt;font-family:'Courier New'">        Trace.Assert(<span style="color:navy">False</span>)</span></strong><span style="font-size:14pt;font-family:'Courier New'"></span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><strong><span style="font-size:14pt;font-family:'Courier New'">        Console.WriteLine(</span></strong><span style="font-size:14pt;color:#a31515;font-family:'Courier New'">&quot;After assert&quot;</span><strong><span style="font-size:14pt;font-family:'Courier New'">)</span></strong><span style="font-size:14pt;font-family:'Courier New'"></span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><strong><span style="font-size:14pt;font-family:'Courier New'">    <span style="color:navy">End</span> <span style="color:navy">Sub</span></span></strong></p> <p class=MsoNormal style="margin:0in 0in 0pt"><strong><span style="font-size:14pt;color:navy;font-family:'Courier New'"> </span></strong></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Calibri">When logged directly into one of the HPC nodes, if you run the application it prints the first line to the console and then puts up a dialog as expected.  But if the application is run as a task in an HPC job, both lines are written to the console and the assert doesn't have any affect.  Is this behavior expected?</span></p>Tue, 16 Jun 2009 18:19:20 Z2009-06-16T18:19:20Zhttp://social.microsoft.com/Forums/en-US/windowshpcsched/thread/3f4ed814-f63e-4801-a680-21fbb808106c#e2ddba4c-6aad-4a29-a065-d09347a4ffc1http://social.microsoft.com/Forums/en-US/windowshpcsched/thread/3f4ed814-f63e-4801-a680-21fbb808106c#e2ddba4c-6aad-4a29-a065-d09347a4ffc1Josh Barnardhttp://social.microsoft.com/Profile/en-US/?user=Josh%20BarnardTrace.Assert Performing As Expected When Run From The Cluster ManagerI asked around a bit.  No body here is quite sure what's going on :-)  Our best guess is that in since jobs run in a non-interactive session, its attempt to put up a dialog fails, it swallows the exception, and then it moves onto the next line of code.<br/><br/>You could try using HPC_ATTACHTOCONSOLE to run your job in an interactive sessoin and see if it behaves differently:<br/><a href="http://blogs.msdn.com/philpenn/archive/2008/08/19/windows-hpc-server-2008-rc2-now-available.aspx">http://blogs.msdn.com/philpenn/archive/2008/08/19/windows-hpc-server-2008-rc2-now-available.aspx</a><br/><br/>Thanks!<br/>Josh<hr class="sig">-JoshWed, 22 Jul 2009 21:49:18 Z2009-07-22T21:49:18Z