Skip to content

Commit 492131c

Browse files
committed
- removed empty delegate from event
1 parent 15fe6b8 commit 492131c

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

Shuttle.Core.Reflection/ReflectionService.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ public class ReflectionService : IReflectionService
1818
".exe"
1919
};
2020

21-
public event EventHandler<ExceptionRaisedEventArgs> ExceptionRaised = delegate
22-
{
23-
};
21+
public event EventHandler<ExceptionRaisedEventArgs> ExceptionRaised;
2422

2523
public string AssemblyPath(Assembly assembly)
2624
{
@@ -48,7 +46,7 @@ public Assembly GetAssembly(string assemblyPath)
4846
}
4947
catch (Exception ex)
5048
{
51-
ExceptionRaised.Invoke(this, new ExceptionRaisedEventArgs($"GetAssembly({assemblyPath})", ex));
49+
ExceptionRaised?.Invoke(this, new ExceptionRaisedEventArgs($"GetAssembly({assemblyPath})", ex));
5250

5351
return null;
5452
}
@@ -71,7 +69,7 @@ public async Task<Assembly> GetAssemblyAsync(string assemblyPath)
7169
}
7270
catch (Exception ex)
7371
{
74-
ExceptionRaised.Invoke(this, new ExceptionRaisedEventArgs($"GetAssembly({assemblyPath})", ex));
72+
ExceptionRaised?.Invoke(this, new ExceptionRaisedEventArgs($"GetAssembly({assemblyPath})", ex));
7573

7674
return null;
7775
}
@@ -378,7 +376,7 @@ public IEnumerable<Type> GetTypes(Assembly assembly)
378376
}
379377
catch (Exception ex)
380378
{
381-
ExceptionRaised.Invoke(this, new ExceptionRaisedEventArgs($"GetTypes({assembly.FullName})", ex));
379+
ExceptionRaised?.Invoke(this, new ExceptionRaisedEventArgs($"GetTypes({assembly.FullName})", ex));
382380

383381
return new List<Type>();
384382
}
@@ -458,7 +456,7 @@ private async Task<IEnumerable<Assembly>> GetMatchingAssembliesAsync(Regex expre
458456
result.AddRange(await Task.WhenAll(
459457
Directory.GetFiles(folder, "*.dll")
460458
.Where(file => expression.IsMatch(Path.GetFileNameWithoutExtension(file)))
461-
.Select(assemblyPath => GetAssemblyAsync(assemblyPath))
459+
.Select(async assemblyPath => await GetAssemblyAsync(assemblyPath).ConfigureAwait(false))
462460
.Where(assembly => assembly != null)));
463461
}
464462

0 commit comments

Comments
 (0)