Skip to content

Commit 54358bf

Browse files
committed
Address PR review comments, add XML docs about DEBUG
1 parent 2872a05 commit 54358bf

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

Rubberduck.Core/UI/Command/MenuItems/CommandBars/SerializeProjectsCommandMenuItem.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ protected override void OnExecute(object parameter)
6666
if (!toSerialize.ContainsKey(type.Guid))
6767
{
6868
toSerialize.Add(type.Guid, type);
69-
}
69+
}
7070
}
7171
}
7272
}
@@ -78,8 +78,12 @@ protected override void OnExecute(object parameter)
7878
}
7979

8080
#if DEBUG
81-
//Dumb hack cos I'm too lazy to wire up another button...
82-
var traceDirectory = Path.Combine(Path.GetDirectoryName(_serializationProvider.Target), "COM Trace");
81+
//This block must be inside a DEBUG block because the Serialize method
82+
//called is conditionally compiled and available only for a DEBUG build.
83+
var path = string.IsNullOrWhiteSpace(_serializationProvider.Target)
84+
? Path.GetDirectoryName(_serializationProvider.Target)
85+
: Path.GetTempPath();
86+
var traceDirectory = Path.Combine(path, "COM Trace");
8387
if (!Directory.Exists(traceDirectory))
8488
{
8589
Directory.CreateDirectory(traceDirectory);

Rubberduck.VBEEditor/ComManagement/ComSafeBase.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,7 @@ private struct TraceData
9090
private const int StackTrackNumberOfElementsToSkipOnAddUpdate = 8;
9191
private const int StackTraceDepth = 5;
9292

93-
/// <summary>
94-
/// Provide a serialized list of the COM Safe
95-
/// to make it easy to analyze what is inside
96-
/// the COM Safe at the different points of
97-
/// the session's lifetime.
98-
/// </summary>
93+
/// <inheritdoc cref="IComSafe.Serialize"/>
9994
public void Serialize(string targetDirectory)
10095
{
10196
lock (_streamLock)

Rubberduck.VBEEditor/ComManagement/IComSafe.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ public interface IComSafe: IDisposable
88
void Add(ISafeComWrapper comWrapper);
99
bool TryRemove(ISafeComWrapper comWrapper);
1010
#if DEBUG
11+
/// <summary>
12+
/// Available in DEBUG build only. Provide a mechanism for serializing both
13+
/// a snapshot of the COM safe at the instant and a historical activity log
14+
/// with a limited stack trace for each entry.
15+
/// </summary>
16+
/// <param name="targetDirectory">The path to a directory to place the serialized files in</param>
1117
void Serialize(string targetDirectory);
1218
#endif
1319
}

0 commit comments

Comments
 (0)