public Task<ServiceResponse<byte[]>> SendAnalysisAsync(AnalyzeRequest a, string format) { var sortedAnalyzeRequest = new AnalyzeRequest { RequestFlags = a.RequestFlags, Dependencies = a.Dependencies .OrderBy(t => t.Key.MemberDocId) .ThenBy(t => t.Key.TypeDocId) .ToDictionary(t => t.Key, t => t.Value.OrderBy(tt => tt.AssemblyIdentity).ToList() as ICollection<AssemblyInfo>), UnresolvedAssemblies = new SortedSet<string>(a.UnresolvedAssemblies, StringComparer.Ordinal), UnresolvedAssembliesDictionary = a.UnresolvedAssembliesDictionary .OrderBy(t => t.Key) .ToDictionary(t => t.Key, t => new SortedSet<string>(t.Value) as ICollection<string>), UserAssemblies = new SortedSet<AssemblyInfo>(a.UserAssemblies), AssembliesWithErrors = new SortedSet<string>(a.AssembliesWithErrors, StringComparer.Ordinal), Targets = new SortedSet<string>(a.Targets, StringComparer.Ordinal), ApplicationName = a.ApplicationName, Version = a.Version, BreakingChangesToSuppress = new SortedSet<string>(a.BreakingChangesToSuppress ?? Enumerable.Empty<string>(), StringComparer.Ordinal), AssembliesToIgnore = a.AssembliesToIgnore.OrderBy(i => i.AssemblyIdentity) }; var result = sortedAnalyzeRequest.Serialize(); return Task.FromResult(ServiceResponse.Create(result)); }
private void WriteOutput(AnalyzeRequest a) { var sortedAnalyzeRequest = new AnalyzeRequest { RequestFlags = a.RequestFlags, Dependencies = a.Dependencies .OrderBy(t => t.Key.MemberDocId) .ThenBy(t => t.Key.TypeDocId) .ToDictionary(t => t.Key, t => t.Value.OrderBy(tt => tt.AssemblyIdentity).ToList() as ICollection<AssemblyInfo>), UnresolvedAssemblies = new SortedSet<string>(a.UnresolvedAssemblies, StringComparer.Ordinal), UnresolvedAssembliesDictionary = a.UnresolvedAssembliesDictionary .OrderBy(t => t.Key) .ToDictionary(t => t.Key, t => new SortedSet<string>(t.Value) as ICollection<string>), UserAssemblies = new SortedSet<AssemblyInfo>(a.UserAssemblies), AssembliesWithErrors = new SortedSet<string>(a.AssembliesWithErrors, StringComparer.Ordinal), Targets = new SortedSet<string>(a.Targets, StringComparer.Ordinal), ApplicationName = a.ApplicationName, Version = a.Version, BreakingChangesToSuppress = new SortedSet<string>(a.BreakingChangesToSuppress ?? Enumerable.Empty<string>(), StringComparer.Ordinal), AssembliesToIgnore = a.AssembliesToIgnore.OrderBy(i => i.AssemblyIdentity) }; var tmp = $"{Path.GetTempFileName()}.json"; using (var ms = new MemoryStream(sortedAnalyzeRequest.Serialize())) using (var fs = File.OpenWrite(tmp)) { ms.CopyTo(fs); } Process.Start(tmp); }