Skip to content

Commit 7bf6bb7

Browse files
authored
Merge pull request #24 from magic5644/fix-dot-fil-truncated-when-large-graph
Improve formatting and reliability in DependencyGraphGenerator
2 parents 5599d49 + 476c21f commit 7bf6bb7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

CodeLineCounter/Services/DependencyGraphGenerator.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.Text;
12
using CodeLineCounter.Models;
23
using DotNetGraph;
34
using DotNetGraph.Attributes;
@@ -84,7 +85,7 @@ private static DotNode CreateNode(Dictionary<string, (int incoming, int outgoing
8485
var info = vertexInfo[vertex];
8586
var node = new DotNode();
8687
node.WithIdentifier(vertex, true);
87-
node.Label = $"{vertex}" +Environment.NewLine + $"\nIn: {info.incoming}, Out: {info.outgoing}";
88+
node.Label = $"{vertex}" + Environment.NewLine + $"\nIn: {info.incoming}, Out: {info.outgoing}";
8889
node.Shape = DotNodeShape.Oval;
8990
node.WithPenWidth(2);
9091

@@ -134,7 +135,7 @@ private static void GroupByNamespace(Dictionary<string, (int incoming, int outgo
134135
targetNamespaceList = [];
135136
namespaceGroups[dep.TargetNamespace] = targetNamespaceList;
136137
}
137-
138+
138139
if (!targetNamespaceList.Contains(dep.TargetClass))
139140
{
140141
targetNamespaceList.Add(dep.TargetClass);
@@ -154,7 +155,8 @@ private static async Task CompileGraphAndWriteToFile(string outputPath, DotGraph
154155

155156
await graph.CompileAsync(context);
156157
var result = writer.GetStringBuilder().ToString();
157-
await File.WriteAllTextAsync(outputPath, result);
158+
//using sync write for reliability with async we got some issues
159+
File.WriteAllText(outputPath, result);
158160
}
159161

160162
private static List<DependencyRelation> FilterAssemblyFromDependencies(string? filterAssembly, List<DependencyRelation> filteredDependencies)

0 commit comments

Comments
 (0)