Here is a simplified code of my problem. The problem is that the debugger skips the last line of code which is
[var _barrelResult = keys.Select(key => _barrel.Get<string>(key));]. If I use foreach loop everything works just fine. I assume that the Select method causes some problem because of an instance of _barrel. Is it possible to get some deeper explanation why this happen? It is very interesting that I do not get any exceptions. Please note this is a simplified example, in general, this code can not be applied in the constructor.
public class ViewModelGeneral: BaseViewModel
{
private readonly IBarrel _barrel = null;
public ViewModelGeneral(IBarrel barrel)
{
_barrel = barrel;
IList<string> keys = new List<string>();
// this approach works just fine
List<string> resultsList = new List<string>();
foreach(var key in keys)
{
var result = _barrel.Get<string>(key);
resultsList.Add(result);
}
// this approach does not work, the debugger skips this line of code
var _barrelResult = keys.Select(key => _barrel.Get<string>(key));
}
}
Here is a simplified code of my problem. The problem is that the debugger skips the last line of code which is
[var _barrelResult = keys.Select(key => _barrel.Get<string>(key));]
. If I use foreach loop everything works just fine. I assume that the Select method causes some problem because of an instance of _barrel. Is it possible to get some deeper explanation why this happen? It is very interesting that I do not get any exceptions. Please note this is a simplified example, in general, this code can not be applied in the constructor.