diff --git a/IntegrationTests/Dual.Tests/Dual.Tests.csproj b/IntegrationTests/Dual.Tests/Dual.Tests.csproj
index a3719e1..7623e00 100644
--- a/IntegrationTests/Dual.Tests/Dual.Tests.csproj
+++ b/IntegrationTests/Dual.Tests/Dual.Tests.csproj
@@ -13,7 +13,7 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/IntegrationTests/MS.Tests/MS.Tests.csproj b/IntegrationTests/MS.Tests/MS.Tests.csproj
index c6fb1ac..40040b1 100644
--- a/IntegrationTests/MS.Tests/MS.Tests.csproj
+++ b/IntegrationTests/MS.Tests/MS.Tests.csproj
@@ -8,7 +8,7 @@
-
+
diff --git a/IntegrationTests/XUnit.Tests/XUnit.Tests.csproj b/IntegrationTests/XUnit.Tests/XUnit.Tests.csproj
index 357745c..b5f65e7 100644
--- a/IntegrationTests/XUnit.Tests/XUnit.Tests.csproj
+++ b/IntegrationTests/XUnit.Tests/XUnit.Tests.csproj
@@ -11,7 +11,7 @@
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/Samples/DevTeam.Tests/DevTeam.Tests.csproj b/Samples/DevTeam.Tests/DevTeam.Tests.csproj
index 0a571d0..f0828e1 100644
--- a/Samples/DevTeam.Tests/DevTeam.Tests.csproj
+++ b/Samples/DevTeam.Tests/DevTeam.Tests.csproj
@@ -16,7 +16,7 @@
-
+
diff --git a/Samples/MS.Tests/MS.Tests.csproj b/Samples/MS.Tests/MS.Tests.csproj
index 77681d1..dbe6602 100644
--- a/Samples/MS.Tests/MS.Tests.csproj
+++ b/Samples/MS.Tests/MS.Tests.csproj
@@ -8,7 +8,7 @@
-
+
diff --git a/TeamCity.VSTest.TestLogger.Tests/TeamCity.VSTest.TestLogger.Tests.csproj b/TeamCity.VSTest.TestLogger.Tests/TeamCity.VSTest.TestLogger.Tests.csproj
index a677d6f..6d974f4 100644
--- a/TeamCity.VSTest.TestLogger.Tests/TeamCity.VSTest.TestLogger.Tests.csproj
+++ b/TeamCity.VSTest.TestLogger.Tests/TeamCity.VSTest.TestLogger.Tests.csproj
@@ -14,7 +14,7 @@
-
+
diff --git a/TeamCity.VSTest.TestLogger/FlowIdGenerator.cs b/TeamCity.VSTest.TestLogger/FlowIdGenerator.cs
index 584c458..63d1d3e 100644
--- a/TeamCity.VSTest.TestLogger/FlowIdGenerator.cs
+++ b/TeamCity.VSTest.TestLogger/FlowIdGenerator.cs
@@ -7,10 +7,29 @@ namespace TeamCity.VSTest.TestLogger
internal class FlowIdGenerator : IFlowIdGenerator
{
private readonly IIdGenerator _idGenerator;
+ private readonly IOptions _options;
+ private bool _isFirst = true;
- public FlowIdGenerator(IIdGenerator idGenerator) =>
+ public FlowIdGenerator(IIdGenerator idGenerator, IOptions options)
+ {
_idGenerator = idGenerator ?? throw new ArgumentNullException(nameof(idGenerator));
+ _options = options;
+ }
- public string NewFlowId() => _idGenerator.NewId();
+ public string NewFlowId()
+ {
+ // ReSharper disable once InvertIf
+ if (_isFirst)
+ {
+ _isFirst = false;
+ var flowId = _options.RootFlowId;
+ if (!string.IsNullOrEmpty(flowId))
+ {
+ return flowId;
+ }
+ }
+
+ return _idGenerator.NewId();
+ }
}
}
diff --git a/TeamCity.VSTest.TestLogger/ServiceLocatorNet35.cs b/TeamCity.VSTest.TestLogger/ServiceLocatorNet35.cs
index 23ed603..df27ba6 100644
--- a/TeamCity.VSTest.TestLogger/ServiceLocatorNet35.cs
+++ b/TeamCity.VSTest.TestLogger/ServiceLocatorNet35.cs
@@ -14,7 +14,7 @@ public IMessageHandler CreateMessageHandler()
var teamCityWriter = new TeamCityServiceMessages(
new ServiceMessageFormatter(),
- new FlowIdGenerator(idGenerator),
+ new FlowIdGenerator(idGenerator, this),
new IServiceMessageUpdater[] {new TimestampUpdater(() => DateTime.Now)}).CreateWriter(Console.WriteLine);
return new MessageHandler(
diff --git a/build.proj b/build.proj
index 8dde69e..d7662f8 100644
--- a/build.proj
+++ b/build.proj
@@ -1,7 +1,7 @@
- 1.0.26
+ 1.0.27
0
$(PackageVersion).$(Build_Number)