Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add runtime location to host log #3806

Merged
merged 8 commits into from
Jun 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/testhost.x86/DefaultEngineInvoker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Reflection;
using System.Threading;
Expand Down Expand Up @@ -100,7 +101,16 @@ public void Invoke(IDictionary<string, string?> argsDictionary)
.GetTypeInfo()
.Assembly
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion;
EqtTrace.Verbose($"Version: {version}");
EqtTrace.Verbose($"Version: {version} Current process architecture: {_processHelper.GetCurrentProcessArchitecture()}");
#if NETCOREAPP2_0_OR_GREATER || NETFRAMEWORK
// https://docs.microsoft.com/en-us/dotnet/api/system.reflection.assembly.location?view=net-6.0#remarks
// In .NET 5 and later versions, for bundled assemblies, the value returned is an empty string.
string objectTypeLocation = typeof(object).Assembly.Location;
if (!objectTypeLocation.IsNullOrEmpty())
{
EqtTrace.Verbose($"Runtime location: {Path.GetDirectoryName(objectTypeLocation)}");
}
#endif
}

if (EqtTrace.IsInfoEnabled)
Expand Down
7 changes: 7 additions & 0 deletions src/vstest.console/Processors/EnableDiagArgumentProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,13 @@ public void Initialize(string? argument)
// Write version to the log here, because that is the
// first place where we know if we log or not.
EqtTrace.Verbose($"Version: {Product.Version} Current process architecture: {_processHelper.GetCurrentProcessArchitecture()}");
// https://docs.microsoft.com/en-us/dotnet/api/system.reflection.assembly.location?view=net-6.0#remarks
// In .NET 5 and later versions, for bundled assemblies, the value returned is an empty string.
string objectTypeLocation = typeof(object).Assembly.Location;
if (!objectTypeLocation.IsNullOrEmpty())
{
EqtTrace.Verbose($"Runtime location: {Path.GetDirectoryName(objectTypeLocation)}");
}
}

/// <summary>
Expand Down