Note that there are some explanatory texts on larger screens.

plurals
  1. POIF condition not met but code still being triggered
    text
    copied!<p>I've come across something really odd which I've never seen before and wondered if anyone could shed light on the issue:</p> <p>The old code:</p> <pre><code>if ((orderFileCreationStatus.OrderFileStatus == OrderFileCreationStatus.Status.ContentCreated || orderFileCreationStatus.OrderFileStatus == OrderFileCreationStatus.Status.NoContent) &amp;&amp; orderFileCreationStatus.SpecialMeasureFileStatus != OrderFileCreationStatus.Status.Published &amp;&amp; orderFileCreationStatus.PersonalisedProductFileStatus != OrderFileCreationStatus.Status.Published) { webOrderHeader.OrderStatus = Domain.Duos.OrderStatus.AwaitingAuthorisation; webOrderHeader.AuthoriserUserId = null; UpdateWebOrderHeader(webOrderHeader); throw new Exception("Could not create the Order File for order ID: " + webOrderHeader.OrderId.ToString() + "rollback"); } </code></pre> <p>The new code:</p> <pre><code>if ((orderFileCreationStatus.OrderFileStatus == OrderFileCreationStatus.Status.ContentCreated || orderFileCreationStatus.OrderFileStatus == OrderFileCreationStatus.Status.NoContent)) { if(orderFileCreationStatus.SpecialMeasureFileStatus != OrderFileCreationStatus.Status.Published) { if(orderFileCreationStatus.PersonalisedProductFileStatus != OrderFileCreationStatus.Status.Published) { webOrderHeader.OrderStatus = Domain.Duos.OrderStatus.AwaitingAuthorisation; webOrderHeader.AuthoriserUserId = null; UpdateWebOrderHeader(webOrderHeader); throw new Exception("Could not create the Order File for order ID: " + webOrderHeader.OrderId.ToString() + "rollback"); } } } </code></pre> <p>Now as far as resharper is concerned these two if statements are identical but here's the catch.</p> <p>In the old code the debugger is skipping the first three lines nested in the IF and throwing the exception.</p> <p>In the new code this works perfectly. Has anyone experienced this before and more importantly what is causing it. I'm intrigued to find out.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload