From 1e80354423b5e2bb32b1ec82aa61cbc1b1a2285c Mon Sep 17 00:00:00 2001 From: mikefourie Date: Tue, 28 Apr 2015 11:19:56 +0100 Subject: [PATCH] Fix self referencing loop detected with 2010 template export #16 --- Manager/Common/CommonAssemblyInfo.cs | 6 +- .../source.extension.vsixmanifest | 2 +- .../ViewModels/BuildManagerViewModel.cs | 64 +++---------------- 3 files changed, 13 insertions(+), 59 deletions(-) diff --git a/Manager/Common/CommonAssemblyInfo.cs b/Manager/Common/CommonAssemblyInfo.cs index 6ebc04c..60d4a0c 100644 --- a/Manager/Common/CommonAssemblyInfo.cs +++ b/Manager/Common/CommonAssemblyInfo.cs @@ -5,9 +5,9 @@ using System.Resources; using System.Runtime.InteropServices; -[assembly: AssemblyVersion("2.12.0.19")] -[assembly: AssemblyFileVersion("2.12.0.19")] -[assembly: AssemblyInformationalVersion("2.12.0.19")] +[assembly: AssemblyVersion("2.12.0.20")] +[assembly: AssemblyFileVersion("2.12.0.20")] +[assembly: AssemblyInformationalVersion("2.12.0.20")] [assembly: AssemblyCompany("Community TFS Build Manager https://github.com/tfsbuildextensions/BuildManager")] [assembly: AssemblyCopyright("Copyright © Community TFS Build Manager https://github.com/tfsbuildextensions/BuildManager")] [assembly: AssemblyTrademark("Community TFS Build Manager https://github.com/tfsbuildextensions/BuildManager")] diff --git a/Manager/TFSBuildManager.Package/source.extension.vsixmanifest b/Manager/TFSBuildManager.Package/source.extension.vsixmanifest index d3fcb99..a214079 100644 --- a/Manager/TFSBuildManager.Package/source.extension.vsixmanifest +++ b/Manager/TFSBuildManager.Package/source.extension.vsixmanifest @@ -1,7 +1,7 @@  - + Community TFS Build Manager VS2013 Community TFS Build Manager VS2013. Sourcecode is available in GitHub - https://github.com/tfsbuildextensions/BuildManager http://visualstudiogallery.msdn.microsoft.com/73bf2d8e-aec6-406c-8e7f-1c678e46557f diff --git a/Manager/TFSBuildManager.Views/ViewModels/BuildManagerViewModel.cs b/Manager/TFSBuildManager.Views/ViewModels/BuildManagerViewModel.cs index 53e5a7f..701646f 100644 --- a/Manager/TFSBuildManager.Views/ViewModels/BuildManagerViewModel.cs +++ b/Manager/TFSBuildManager.Views/ViewModels/BuildManagerViewModel.cs @@ -487,7 +487,13 @@ public static void ExportDefinition(BuildDefinitionViewModel b, string filePath) } } - File.WriteAllText(Path.Combine(filePath, b.Name + ".json"), JsonConvert.SerializeObject(buildToExport, Formatting.Indented)); + var jsonSerializerSettings = new JsonSerializerSettings + { + PreserveReferencesHandling = PreserveReferencesHandling.Objects, + ReferenceLoopHandling = ReferenceLoopHandling.Serialize + }; + + File.WriteAllText(Path.Combine(filePath, b.Name + ".json"), JsonConvert.SerializeObject(buildToExport, Formatting.Indented, jsonSerializerSettings)); } public void OnCleanDrops() @@ -1049,61 +1055,9 @@ public void AssignBuilds(IEnumerable queuedBuilds) { try { - ////PerformanceCounterCategory[] array = PerformanceCounterCategory.GetCategories(); - ////PerformanceCounter[] myCounters = null; - ////foreach (PerformanceCounterCategory t in array) - ////{ - //// if (t.CategoryName.Equals(".NET CLR Networking 4.0.0.0")) - //// { - //// System.Diagnostics.Debug.WriteLine(".NET CLR Networking 4.0.0.0 instances:" + string.Join(", ", t.GetInstanceNames())); - //// string myInstance = t.GetInstanceNames() - //// .FirstOrDefault( - //// x => - //// x.StartsWith( - //// AppDomain.CurrentDomain.FriendlyName.ToLower() + "_p" - //// + Process.GetCurrentProcess().Id.ToString(CultureInfo.InvariantCulture), - //// StringComparison.OrdinalIgnoreCase)); - //// if (myInstance != null) - //// { - //// myCounters = t.GetCounters(myInstance); - //// } - //// } - ////} - - ////////var c = new PerformanceCounter(".NET CLR Networking 4.0.0.0", "Bytes Received", myInstance, true); - ////CounterSample s = new CounterSample(); - ////PerformanceCounter c = null; - ////if (myCounters != null) - ////{ - //// c = myCounters.First(x => x.CounterName.Equals("Bytes Received")); - //// s = c.NextSample(); - //// System.Diagnostics.Debug.WriteLine( - //// "{0}. Name={1} Type={2}", - //// c.CategoryName, - //// c.CounterName, - //// c.CounterType); - //// System.Diagnostics.Debug.WriteLine("+++++++++++"); - //// System.Diagnostics.Debug.WriteLine("Sample values -"); - //// System.Diagnostics.Debug.WriteLine(" BaseValue = " + s.BaseValue); - //// System.Diagnostics.Debug.WriteLine(" CounterFrequency = " + s.CounterFrequency); - //// System.Diagnostics.Debug.WriteLine(" CounterTimeStamp = " + s.CounterTimeStamp); - //// System.Diagnostics.Debug.WriteLine(" CounterType = " + s.CounterType); - //// System.Diagnostics.Debug.WriteLine(" RawValue = " + s.RawValue); - //// System.Diagnostics.Debug.WriteLine(" SystemFrequency = " + s.SystemFrequency); - //// System.Diagnostics.Debug.WriteLine(" TimeStamp = " + s.TimeStamp); - //// System.Diagnostics.Debug.WriteLine(" TimeStamp100nSec = " + s.TimeStamp100nSec); - ////} - - ////System.Diagnostics.Debug.WriteLine("++++++++++++++++++++++"); - this.Builds.Clear(); foreach (var b in queuedBuilds.Where(b => b != null).Select(b => new BuildViewModel(b))) { - ////if (c != null) - ////{ - //// System.Diagnostics.Debug.WriteLine(" RawValue {0} = {1} {2} {3}", b.BuildDefinition, c.RawValue - s.RawValue, c.RawValue, b.QueuedBuildDetail.Status); - ////} - this.Builds.Add(b); } } @@ -1298,7 +1252,7 @@ private void OnCloneBuilds() { this.repository.CloneBuild(item.Uri, dlg.NewBuildDefinitionName, branchObject, dlg.SelectedTargetBranch); } - else if (res.HasValue && !res.Value) + else if (res.HasValue) { break; } @@ -1378,7 +1332,7 @@ private void OnCloneBuildToProject() this.OnRefresh(new EventArgs()); } - else if (res.HasValue && !res.Value) + else if (res.HasValue) { break; }