Skip to content

Commit

Permalink
NullReferenceException when using the data visualizer on a Serilog/Cl…
Browse files Browse the repository at this point in the history
…ef log file. Fix #189
  • Loading branch information
LiorBanai committed Jun 18, 2020
1 parent 10cd6fa commit bbe171d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Analogy/Analogy.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<Product>Analogy Log Viewer</Product>
<Description>Modern Log Viewer and analyzer.</Description>
<Copyright>Copyright @ Lior Banai 2020</Copyright>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.2.0</AssemblyVersion>
<FileVersion>4.2.1.0</FileVersion>
<NoWarn>1591;1573;0419;1607</NoWarn>
<PlatformToolset>v120</PlatformToolset>
Expand Down Expand Up @@ -80,7 +80,7 @@
<PropertyGroup>
<PreBuildEvent />
<PostBuildEvent />
<Version>4.2.1</Version>
<Version>4.2.2</Version>
<RepositoryUrl>https://github.com/Analogy-LogViewer/Analogy.LogViewer</RepositoryUrl>
<PackageIcon>icon.png</PackageIcon>
<PackageIconUrl />
Expand Down
5 changes: 3 additions & 2 deletions Analogy/CommonChangeLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ public static IEnumerable<AnalogyChangeLog> GetChangeLog()
return new List<AnalogyChangeLog>
{

new AnalogyChangeLog("Upgrade to DevExpress 19.1.11. #187",AnalogChangeLogType.Improvement,"Lior Banai", new DateTime(2020, 06, 11)),
new AnalogyChangeLog("Reload file is ignore when caching is on #181",AnalogChangeLogType.Bug,"Lior Banai", new DateTime(2020, 06, 04)),
new AnalogyChangeLog("NullReferenceException when using the data visualizer on a Serilog/Clef log file #189",AnalogChangeLogType.Bug,"Lior Banai", new DateTime(2020, 06, 18)),
new AnalogyChangeLog("Upgrade to DevExpress 19.1.11. #187",AnalogChangeLogType.Improvement,"Lior Banai", new DateTime(2020, 06, 11)),
new AnalogyChangeLog("Reload file is ignore when caching is on #181",AnalogChangeLogType.Bug,"Lior Banai", new DateTime(2020, 06, 04)),
new AnalogyChangeLog("Log Analysis: Add free-text pie chart #177",AnalogChangeLogType.Improvement,"Lior Banai", new DateTime(2020, 05, 29)),
new AnalogyChangeLog("Store date sorting order between runs #178",AnalogChangeLogType.Improvement,"Lior Banai", new DateTime(2020, 05, 29)),
new AnalogyChangeLog("Allows application to minimized to the tray bar instead of closing #174",AnalogChangeLogType.Improvement,"Lior Banai", new DateTime(2020, 05, 28)),
Expand Down
12 changes: 6 additions & 6 deletions Analogy/Types/LogStatistics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public List<Statistics> CalculateTextStatistics()
public void ClearTexts() => Texts.Clear();
public IEnumerable<ItemStatistics> CalculateModulesStatistics()
{
foreach (var module in Modules)
foreach (var module in Modules.Where(m => m != null))
{
yield return CalculateSingleStatistics(module);

Expand All @@ -51,7 +51,7 @@ public IEnumerable<ItemStatistics> CalculateModulesStatistics()

public ItemStatistics CalculateSingleStatistics(string module)
{
return new ItemStatistics(module, Messages.Count(m => m.Module.Equals(module)),
return new ItemStatistics(module, Messages.Count(m => module.Equals(m.Module)),
CountModuleMessages(module, AnalogyLogLevel.Error), CountModuleMessages(module, AnalogyLogLevel.Warning),
CountModuleMessages(module, AnalogyLogLevel.Critical), CountModuleMessages(module, AnalogyLogLevel.Event),
CountModuleMessages(module, AnalogyLogLevel.Debug), CountModuleMessages(module, AnalogyLogLevel.Verbose));
Expand All @@ -60,9 +60,9 @@ public ItemStatistics CalculateSingleStatistics(string module)

public IEnumerable<ItemStatistics> CalculateSourcesStatistics()
{
foreach (var source in Sources)
foreach (var source in Sources.Where(s => s != null))
{
yield return new ItemStatistics(source, Messages.Count(m => m.Source.Equals(source)),
yield return new ItemStatistics(source, Messages.Count(m => source.Equals(m.Source)),
CountSourceMessages(source, AnalogyLogLevel.Error), CountSourceMessages(source, AnalogyLogLevel.Warning),
CountSourceMessages(source, AnalogyLogLevel.Critical), CountSourceMessages(source, AnalogyLogLevel.Event),
CountSourceMessages(source, AnalogyLogLevel.Debug), CountSourceMessages(source, AnalogyLogLevel.Verbose));
Expand All @@ -71,7 +71,7 @@ public IEnumerable<ItemStatistics> CalculateSourcesStatistics()
}

private int CountMessages(List<AnalogyLogMessage> messages, AnalogyLogLevel level) => messages.Count(m => m.Level == level);
private int CountModuleMessages(string module, AnalogyLogLevel level) => Messages.Count(m => m.Level == level && m.Module.Equals(module));
private int CountSourceMessages(string source, AnalogyLogLevel level) => Messages.Count(m => m.Level == level && m.Source.Equals(source));
private int CountModuleMessages(string module, AnalogyLogLevel level) => Messages.Count(m => m.Level == level && module.Equals(m.Module));
private int CountSourceMessages(string source, AnalogyLogLevel level) => Messages.Count(m => m.Level == level && source.Equals(m.Source));
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<a href="https://github.com/Analogy-LogViewer/Analogy.LogViewer/releases">
<img src="https://img.shields.io/github/v/release/Analogy-LogViewer/Analogy.LogViewer" alt="Latest Release" />
</a>
<a href="https://github.com/Analogy-LogViewer/Analogy.LogViewer/compare/V4.2.1...master">
<a href="https://github.com/Analogy-LogViewer/Analogy.LogViewer/compare/V4.2.2...master">
<img src="https://img.shields.io/github/commits-since/Analogy-LogViewer/Analogy.LogViewer/latest" alt="Commits Since Latest Release"/>
</a>
</p>
Expand Down

0 comments on commit bbe171d

Please sign in to comment.