When I'm debugging code everything is OK, and I don't get any errors, but without debugging I'm getting object reference not set to an instance of an object.
public async Task Execute(int id)
{
var items = repository.GetItems(id);
while(condition)
{
try
{
foreach (var item in items)
{
DoSomeWork(item);
}
}
catch (Exception ex) { }
}
await Task.Delay(1000);
}