Question: I have the most peculiar problem that none of the guys in my office came across or know how to handle, maybe you guys will find where's the catch.

In my verilog testbench, I have the following compare code: 

```
if (refFifo[7:0] != DUT.fifo[7:0] && rnd == 1) begin
  $display("Error! ref Fifo %h not equal DUT fifo %h after 1 byte", refFifo[7:0], DUT.fifo[7:0]);
  $stop;
end
else if (refFifo[15:0] != DUT.fifo[15:0] && rnd == 2) begin
  $display("Error! ref Fifo %h not equal DUT fifo %h after 2 byte", refFifo[15:0], DUT.fifo[15:0]);
  $stop;
end

```

... (until 5 bytes)  

`else  

$display("Success!");`  

Now, the problem is that the comparison of 2 is *always* failing, while the rest of the comparisons pass smoothly (and this screws up with my runs):  

'>Error: ref Fifo 090c not equal DUT fifo 090c after 2 byte'  

I tried changing the position of the compare in the process, printing the values before the compare (in case they changed somehow during the compare), adding parenthesis, changing the compare range to [7:0] and building a new environment but nothing helped or gave some indication of what goes wrong with the compare of 2 bytes.  

Did anyone ever came across such a problem? does anyone have an idea of how to solve it?  

I run with ModelSim 10.1d\_1 with no optimization, in case it has something to do with my enigma.  

**update** also tried it on ModelSim 10.0d\_1, but with no help.

Answer: 
You don't go into much detail into what error you are getting (if any), so it's difficult to say.

Having said that, here's a few things that come to mind:

* If you call `NotifyComplete()` before the asynchronous call *completes*, you may be being shut down before you have the chance
* Background tasks only have 6mb of memory (12mb on WP8). If you go over it your process will be terminated
* Background tasks only have 25 seconds or so to execute. If you continue past this your process will be terminated.
* [Don't use the `IsolatedStorageSettings` class to share state between processes](http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202944%28v=vs.105%29.aspx#BKMK_CommunicationBetweenForegroundApplicationandBackgroundAgent)
* You should be using a `Mutex` to protect process-process access to your storage.
What exactly is the problem you're experiencing? Using IsolatedStorageSettings shouldn't restrict the size of the list you're able to persist.