Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortherzok <marius.ungureanu@xamarin.com>2019-06-28 11:00:41 +0300
committertherzok <marius.ungureanu@xamarin.com>2019-07-06 22:17:32 +0300
commit5b32ab1ae40fed6dfd1bdc0601b6c5a88d0ea349 (patch)
tree9b12a0de16917ba09fde4633c7b17d2a8ce3a644 /main/src/core/MonoDevelop.Core
parentcb0663c0819aa3f79b69de0806ca2f556ef3c437 (diff)
Avoid doing expensive work to trigger OnPathChanged when it might not be subscribed to
Fixes VSTS #936533 - ProjectFile.OnPathChanged computes values that are not used
Diffstat (limited to 'main/src/core/MonoDevelop.Core')
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectFile.cs15
1 files changed, 9 insertions, 6 deletions
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectFile.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectFile.cs
index a2a18d15c8..5bcb0a315d 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectFile.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectFile.cs
@@ -173,8 +173,8 @@ namespace MonoDevelop.Projects
set {
Debug.Assert (!String.IsNullOrEmpty (value));
- FilePath oldVirtualPath = ProjectVirtualPath;
FilePath oldPath = filename;
+ FilePath oldLink = Link;
filename = FileService.GetFullPath (value);
@@ -194,7 +194,7 @@ namespace MonoDevelop.Projects
if (Project != null)
UnevaluatedInclude = Include;
- OnPathChanged (oldPath, filename, oldVirtualPath, ProjectVirtualPath);
+ OnPathChanged (oldPath, oldLink);
if (Project != null)
Project.NotifyFileRenamedInProject (new ProjectFileRenamedEventArgs (Project, this, oldPath));
@@ -525,12 +525,15 @@ namespace MonoDevelop.Projects
internal event EventHandler<ProjectFilePathChangedEventArgs> PathChanged;
- void OnPathChanged (FilePath oldPath, FilePath newPath, FilePath oldVirtualPath, FilePath newVirtualPath)
+ void OnPathChanged (FilePath oldPath, FilePath oldLink)
{
- var handler = PathChanged;
+ PathChanged?.Invoke (this, CreateEventArgs ());
- if (handler != null)
- handler (this, new ProjectFilePathChangedEventArgs (this, oldPath, newPath, oldVirtualPath, newVirtualPath));
+ ProjectFilePathChangedEventArgs CreateEventArgs ()
+ {
+ var oldVirtualPath = GetProjectVirtualPath (oldLink, oldPath, Project);
+ return new ProjectFilePathChangedEventArgs (this, oldPath, filename, oldVirtualPath, ProjectVirtualPath);
+ }
}
protected virtual void OnChanged (string property)