Conversation
|
|
||
| XmlPersistence helper = new(); | ||
| helper.SaveSimpleField(element, "@agentName", _agentName, null); | ||
| helper.SaveSimpleField(element, "@agentDisplayName", _agentDisplayName, _agentName); |
There was a problem hiding this comment.
What this line was saying is to set agentDisplayName attribute value to _agentDisplayName if and only if it's different from _agentName.
However, _agentDisplayName and _agentName were always the same. So, this line was always not doing anything. So simplified this class also by removing _agentDisplayName completely.
| XmlPersistence helper = new(); | ||
| helper.SaveSimpleField(element, "@agentName", _agentName, null); | ||
| helper.SaveSimpleField(element, "@agentDisplayName", _agentDisplayName, _agentName); | ||
| helper.SaveSimpleField(element, "@isFromRemoteAgent", _isFromRemoteAgent, false); |
There was a problem hiding this comment.
This line would only set isFromRemoteAgent attribute if and only if it's not false. However, it was always false. So removed completely to simplify.
| /// <param name="resultsDirectory">The results directory to use to make paths in the data attachments relative or absolute</param> | ||
| /// <param name="useAbsolutePaths">True to use absolute paths in this instance, false to use relative paths</param> | ||
| /// <returns>A clone of the instance containing cloned attachments with file paths made absolute or relative</returns> | ||
| internal CollectorDataEntry Clone(string resultsDirectory, bool useAbsolutePaths) |
There was a problem hiding this comment.
This was always called with useAbsolutePaths: false.
So, removing the bool parameter and renaming to CloneWithRelativePath.
| /// <param name="useAbsoluteUri">True to use an absolute URI in the clone, false to use a relative URI</param> | ||
| /// <returns>A clone of the instance, with the URI made absolute</returns> | ||
| internal UriDataAttachment Clone(string baseDirectory, bool useAbsoluteUri) | ||
| internal UriDataAttachment CloneWithRelativePath(string baseDirectory) |
There was a problem hiding this comment.
This was always called with useAbsoluteUri: false. So, removed the parameter and renamed to CloneWithRelativePath.
There was a problem hiding this comment.
Pull request overview
Removes unused/duplicate TRX logger fields and simplifies cloning/serialization logic for collector data and URI attachments.
Changes:
- Simplifies
CollectorDataEntryby removing agent display name / remote-agent metadata and updating construction/callers. - Replaces attachment cloning APIs to always produce relative paths (
CloneWithRelativePath). - Removes duplicate constructor argument usage in
Converter.ToCollectorEntry.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/Converter.cs | Updates CollectorDataEntry creation to match the simplified constructor signature. |
| src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/UriDataAttachment.cs | Renames/simplifies cloning to produce relative URIs and removes unused System.IO usage. |
| src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestResult.cs | Updates collector entry cloning call to the new relative-path clone API. |
| src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/CollectorDataEntry.cs | Removes agent display/remote metadata, updates serialization and clone API accordingly. |
Comments suppressed due to low confidence (1)
src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/CollectorDataEntry.cs:1
- This change stops emitting
@agentDisplayNameand@isFromRemoteAgentin the serialized TRX. That is an observable output-format change that may break consumers expecting those attributes to exist (even if defaulted). If the intent is purely internal cleanup, consider continuing to write these attributes with default values (e.g., display name = agent name, remote = false) or documenting this as a deliberate TRX schema/output breaking change.
// Copyright (c) Microsoft Corporation. All rights reserved.
No description provided.