Skip to content

Commit

Permalink
fix exception logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Maassoft committed Nov 26, 2020
1 parent 0c5d3b4 commit f46fcbf
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 0 additions & 2 deletions ColorControl.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ VisualStudioVersion = 16.0.30128.74
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ColorControl", "ColorControl\ColorControl.csproj", "{A6005D08-70F0-44CB-A384-9219EBA84F21}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{0373E1EF-1DE6-4BCB-BC95-2D7961DBA194}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
2 changes: 1 addition & 1 deletion ColorControl/ColorControl.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<ProductName>ColorControl</ProductName>
<PublisherName>Maassoft</PublisherName>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.3.3.0</ApplicationVersion>
<ApplicationVersion>1.3.4.0</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
Expand Down
7 changes: 5 additions & 2 deletions ColorControl/ExceptionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ static class ExceptionExtensions
public static string ToLogString(this Exception exception, string environmentStackTrace = "")
{
List<string> environmentStackTraceLines = ExceptionExtensions.GetUserStackTraceLines(environmentStackTrace);
environmentStackTraceLines.RemoveAt(0);
if (environmentStackTraceLines.Any())
{
environmentStackTraceLines.RemoveAt(0);
}

List<string> stackTraceLines = ExceptionExtensions.GetStackTraceLines(exception.StackTrace);
stackTraceLines.AddRange(environmentStackTraceLines);
Expand All @@ -46,7 +49,7 @@ private static List<string> GetStackTraceLines(string stackTrace)
private static List<string> GetUserStackTraceLines(string fullStackTrace)
{
List<string> outputList = new List<string>();
Regex regex = new Regex(@"([^\)]*\)) in (.*):line (\d)*$");
Regex regex = new Regex(@"([^\)]*\)) in (.*):([A-z]*) (\d)*$");

List<string> stackTraceLines = ExceptionExtensions.GetStackTraceLines(fullStackTrace);
foreach (string stackTraceLine in stackTraceLines)
Expand Down
4 changes: 2 additions & 2 deletions ColorControl/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.3.0")]
[assembly: AssemblyFileVersion("1.3.3.0")]
[assembly: AssemblyVersion("1.3.4.0")]
[assembly: AssemblyFileVersion("1.3.4.0")]

0 comments on commit f46fcbf

Please sign in to comment.