Skip to content

Commit

Permalink
First attempt to fix performance issues
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanKert committed Oct 6, 2017
1 parent 3392950 commit 351e759
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 33 deletions.
48 changes: 26 additions & 22 deletions BuildVision.UI/Common/Logging/TraceManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,37 +60,41 @@ public static void Trace(string message, EventLogEntryType type)

private static void TraceAction(string message, EventLogEntryType type)
{
// ActivityLog works if devenv.exe started with /log switch.
// Read more https://msdn.microsoft.com/en-us/library/ms241272.aspx.
switch (type)
System.Threading.Tasks.Task.Run(() =>
{
case EventLogEntryType.Error:
ActivityLog.LogError(Resources.ProductName, message);

// ActivityLog works if devenv.exe started with /log switch.
// Read more https://msdn.microsoft.com/en-us/library/ms241272.aspx.
switch (type)
{
case EventLogEntryType.Error:
ActivityLog.LogError(Resources.ProductName, message);
#if DEBUG
System.Diagnostics.Trace.TraceError(message);
MessageBox.Show(message, Resources.ProductName + " error", MessageBoxButton.OK, MessageBoxImage.Error);
System.Diagnostics.Trace.TraceError(message);
MessageBox.Show(message, Resources.ProductName + " error", MessageBoxButton.OK, MessageBoxImage.Error);
#endif
break;
break;

case EventLogEntryType.Warning:
case EventLogEntryType.FailureAudit:
ActivityLog.LogWarning(Resources.ProductName, message);
case EventLogEntryType.Warning:
case EventLogEntryType.FailureAudit:
ActivityLog.LogWarning(Resources.ProductName, message);
#if DEBUG
System.Diagnostics.Trace.TraceWarning(message);
System.Diagnostics.Trace.TraceWarning(message);
#endif
break;
break;

case EventLogEntryType.Information:
case EventLogEntryType.SuccessAudit:
ActivityLog.LogInformation(Resources.ProductName, message);
case EventLogEntryType.Information:
case EventLogEntryType.SuccessAudit:
ActivityLog.LogInformation(Resources.ProductName, message);
#if DEBUG
System.Diagnostics.Trace.TraceInformation(message);
System.Diagnostics.Trace.TraceInformation(message);
#endif
break;
break;

default:
throw new ArgumentOutOfRangeException("type");
}
default:
throw new ArgumentOutOfRangeException("type");
}
});
}

/// <summary>
Expand Down Expand Up @@ -169,4 +173,4 @@ public static string ToLogString(this Exception ex, string additionalMessage)
return msg.ToString();
}
}
}
}
6 changes: 5 additions & 1 deletion BuildVision/Helpers/ProjectExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,10 @@ public static string GetExtenderNames(this Project project)

return string.Join("; ", extenderNames);
}
catch (ArgumentException ex)
{
return ""; // Leaving this in for now until visual studio team fixes the issue with extendernames
}
catch (Exception ex)
{
ex.TraceUnknownException();
Expand Down Expand Up @@ -683,4 +687,4 @@ public static Microsoft.Build.Evaluation.Project GetMsBuildProject(this Project
return new Microsoft.Build.Evaluation.Project(root);
}
}
}
}
22 changes: 12 additions & 10 deletions BuildVision/Tool/Tool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
using BuildVision.UI.Models;
using BuildVision.UI.Settings.Models.ToolWindow;

using System.Threading.Tasks;

namespace BuildVision.Tool
{
public class Tool
Expand Down Expand Up @@ -407,19 +409,19 @@ private void BuildEvents_OnBuildProcess()
{
try
{
var labelsSettings = _viewModel.ControlSettings.BuildMessagesSettings;
string msg = _origTextCurrentState + BuildMessages.GetBuildBeginExtraMessage(_buildContext, labelsSettings);
Task.Run(() =>
{
var labelsSettings = _viewModel.ControlSettings.BuildMessagesSettings;
string msg = _origTextCurrentState + BuildMessages.GetBuildBeginExtraMessage(_buildContext, labelsSettings);

_viewModel.TextCurrentState = msg;
OutputInStatusBar(msg, true);
//_dte.SuppressUI = false;
_viewModel.TextCurrentState = msg;
OutputInStatusBar(msg, true);
//_dte.SuppressUI = false;

var buildingProjects = _buildContext.BuildingProjects;
lock (((ICollection)buildingProjects).SyncRoot)
{
var buildingProjects = _buildContext.BuildingProjects;
for (int i = 0; i < buildingProjects.Count; i++)
buildingProjects[i].RaiseBuildElapsedTimeChanged();
}
});
}
catch (Exception ex)
{
Expand Down Expand Up @@ -541,4 +543,4 @@ private void ApplyToolWindowStateAction(WindowStateAction windowStateAction)
}
}
}
}
}

0 comments on commit 351e759

Please sign in to comment.