Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have sort of found the issue (well my code now works anyway)</p> <p>The issue turned out to be some Linq code.</p> <p>The loop which was failing was as follows</p> <pre><code>for (int i = 0; i &lt; recordLista.Count; i++) { int id = (from r in WrittenRecords where r == recordLista[i].RequestID select r).FirstOrDefault(); if (id != 0) { //do something } } </code></pre> <p>WrittenRecords is a <code>List&lt;int&gt;</code></p> <p>The ling line never got hit (as the loop failed as soon as I stepped into it), so this never looked like the problem. However it was indeed the issue. Not sure why this line also stopped code far above it from working too (ie instantiating the recordLista List) but it did indeed cause issues all over the place.</p> <p>The actual problem was that the WrittenRecords integer list was returned as an empty list (not null, but had no items) and although before entering the loop WrittenRecords did report to be an empty list once the try catch had caught the error it then reported it as Null which is still baffling me..... However as I never need this code to run if there are no items in the list, putting an if statement around the for loop to only allow it to run if WrittenRecords contains items seems to have solved the issue.</p> <p>I however still have no idea why the loop failed to execute at all, why the linq code failed with what was simply an empty list, why the empty list suddenly turned into a null list on the catch or indeed why the error thrown by linq stated that it was null or why the linq code stopped the recordLista from being instantiated at all. But at least my code now works.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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