Hi
I'm using Linq in my windows service, it worked fine with no of testing done.
Now suddenly a linq exception is thrown. Below is the detail;
Message: Sequence contains no matching element
StackTrace: at System.Linq.Enumerable.First[TSource](IEnumerable`1 source, Func`2 predicate)
at MyNamespace.MyClass.MyMethod();
Lines of Code using Linq are:
1.
var files = sourcedirInfo.GetFiles("*", SearchOption.TopDirectoryOnly).Where(f => f.Extension.ToLower().Contains("jpg") || f.Extension.ToLower().Contains("jpeg"));
2.
ScaleConfigurationElement scaleConfiguration = null;
scaleConfiguration = resizeConfigurationSection.Sizes.OfType<ScaleConfigurationElement>().First<ScaleConfigurationElement>(sc => longestEdgeLength >= sc.EdgeLengthMinimum && longestEdgeLength <= sc.EdgeLengthMaximum);