Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewvk committed Jun 13, 2018
1 parent 633a201 commit 45e6746
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Main/src/Collections/QueryableExtensions.Ranges.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public static IQueryable<T> Intersect<T, TValue>(

var predicate = left != null && right != null
? And(left, right)
: (left ?? right ?? FalseExpression());
: left ?? right ?? FalseExpression();

// DbEnd >= @from AND DbStart <= @to
return source.Where(Lambda<Func<T, bool>>(predicate, eParam));
Expand Down
35 changes: 13 additions & 22 deletions Main/src/ExceptionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,27 +43,18 @@ public static StringBuilder ToDiagnosticString(this Exception exception, [NotNul
if (ex.StackTrace.NotNullNorEmpty())
stringBuilder.AppendLine(ex.StackTrace);

if (ex is FileNotFoundException notFoundException)
{
var fex = notFoundException;

stringBuilder.AppendLine($"File Name: {fex.FileName}");

if (fex.FusionLog.IsNullOrEmpty())
{
stringBuilder.AppendLine("Fusion log is empty or disabled.");
}
else
{
stringBuilder.Append(fex.FusionLog);
}
}
else
{
var aex = ex as AggregateException;

if (aex?.InnerExceptions != null)
{
switch (ex) {
case FileNotFoundException notFoundException:
var fex = notFoundException;

stringBuilder.AppendLine($"File Name: {fex.FileName}");

if (fex.FusionLog.IsNullOrEmpty())
stringBuilder.AppendLine("Fusion log is empty or disabled.");
else
stringBuilder.Append(fex.FusionLog);
break;
case AggregateException aex when aex.InnerExceptions != null:
var foundInnerException = false;

foreach (var e in aex.InnerExceptions)
Expand All @@ -74,7 +65,7 @@ public static StringBuilder ToDiagnosticString(this Exception exception, [NotNul

if (foundInnerException)
ex = ex.InnerException;
}
break;
}
}

Expand Down
2 changes: 1 addition & 1 deletion Main/src/Reflection/MemberAccessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Expression MakeGetter(Expression ex, int i)
// Build setter.
//
{
HasSetter = !infos.Any(info => info.member is PropertyInfo && ((PropertyInfo)info.member).GetSetMethod(true) == null);
HasSetter = !infos.Any(info => info.member is PropertyInfo propertyInfo && propertyInfo.GetSetMethod(true) == null);

var valueParam = Expression.Parameter(Type, "value");

Expand Down
1 change: 0 additions & 1 deletion Main/src/Reflection/ReflectionExtensions.CreateInstance.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;

Expand Down

0 comments on commit 45e6746

Please sign in to comment.