Compare commits

...

1 Commits

Author SHA1 Message Date
Pavel Iakovenko
f8cd472d17 Upgrade to .net6 2021-11-11 21:44:58 -05:00
28 changed files with 59 additions and 84 deletions

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>net6</TargetFramework>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64</RuntimeIdentifiers> <RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64</RuntimeIdentifiers>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch> <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>

View File

@@ -243,6 +243,7 @@ namespace GitHub.Runner.Listener
validator: Validators.ServerUrlValidator); validator: Validators.ServerUrlValidator);
} }
#if OS_WINDOWS
public string GetWindowsLogonAccount(string defaultValue, string descriptionMsg) public string GetWindowsLogonAccount(string defaultValue, string descriptionMsg)
{ {
return GetArgOrPrompt( return GetArgOrPrompt(
@@ -251,6 +252,7 @@ namespace GitHub.Runner.Listener
defaultValue: defaultValue, defaultValue: defaultValue,
validator: Validators.NTAccountValidator); validator: Validators.NTAccountValidator);
} }
#endif
public string GetWindowsLogonPassword(string accountName) public string GetWindowsLogonPassword(string accountName)
{ {

View File

@@ -67,6 +67,7 @@ namespace GitHub.Runner.Listener.Configuration
return !string.IsNullOrEmpty(value); return !string.IsNullOrEmpty(value);
} }
#if OS_WINDOWS
public static bool NTAccountValidator(string arg) public static bool NTAccountValidator(string arg)
{ {
if (string.IsNullOrEmpty(arg) || String.IsNullOrEmpty(arg.TrimStart('.', '\\'))) if (string.IsNullOrEmpty(arg) || String.IsNullOrEmpty(arg.TrimStart('.', '\\')))
@@ -87,5 +88,6 @@ namespace GitHub.Runner.Listener.Configuration
return true; return true;
} }
#endif
} }
} }

View File

@@ -129,7 +129,7 @@ namespace GitHub.Runner.Listener
private static void LoadAndSetEnv() private static void LoadAndSetEnv()
{ {
var binDir = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); var binDir = Path.GetDirectoryName(AppContext.BaseDirectory);
var rootDir = new DirectoryInfo(binDir).Parent.FullName; var rootDir = new DirectoryInfo(binDir).Parent.FullName;
string envFile = Path.Combine(rootDir, ".env"); string envFile = Path.Combine(rootDir, ".env");
if (File.Exists(envFile)) if (File.Exists(envFile))

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>net6</TargetFramework>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64</RuntimeIdentifiers> <RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64</RuntimeIdentifiers>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch> <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>

View File

@@ -95,7 +95,7 @@ namespace GitHub.Runner.PluginHost
string assemblyFilename = assembly.Name + ".dll"; string assemblyFilename = assembly.Name + ".dll";
if (string.IsNullOrEmpty(executingAssemblyLocation)) if (string.IsNullOrEmpty(executingAssemblyLocation))
{ {
executingAssemblyLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); executingAssemblyLocation = Path.GetDirectoryName(AppContext.BaseDirectory);
} }
return context.LoadFromAssemblyPath(Path.Combine(executingAssemblyLocation, assemblyFilename)); return context.LoadFromAssemblyPath(Path.Combine(executingAssemblyLocation, assemblyFilename));
} }

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>net6</TargetFramework>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64</RuntimeIdentifiers> <RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64</RuntimeIdentifiers>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch> <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>

View File

@@ -444,7 +444,7 @@ namespace GitHub.Runner.Plugins.Artifact
{ {
// We should never // We should never
context.Error($"Error '{ex.Message}' when downloading file '{fileToDownload}'. (Downloader {downloaderId})"); context.Error($"Error '{ex.Message}' when downloading file '{fileToDownload}'. (Downloader {downloaderId})");
throw ex; throw;
} }
} }
@@ -528,7 +528,7 @@ namespace GitHub.Runner.Plugins.Artifact
catch (Exception ex) catch (Exception ex)
{ {
context.Output($"File error '{ex.Message}' when uploading file '{fileToUpload}'."); context.Output($"File error '{ex.Message}' when uploading file '{fileToUpload}'.");
throw ex; throw;
} }
} }

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>net6</TargetFramework>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64</RuntimeIdentifiers> <RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64</RuntimeIdentifiers>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch> <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>net6</TargetFramework>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64</RuntimeIdentifiers> <RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64</RuntimeIdentifiers>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch> <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>

View File

@@ -59,7 +59,7 @@ namespace GitHub.Runner.Worker.Expressions
context.Trace.Info($"Search root directory: '{githubWorkspace}'"); context.Trace.Info($"Search root directory: '{githubWorkspace}'");
context.Trace.Info($"Search pattern: '{string.Join(", ", patterns)}'"); context.Trace.Info($"Search pattern: '{string.Join(", ", patterns)}'");
string binDir = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); string binDir = Path.GetDirectoryName(AppContext.BaseDirectory);
string runnerRoot = new DirectoryInfo(binDir).Parent.FullName; string runnerRoot = new DirectoryInfo(binDir).Parent.FullName;
string node = Path.Combine(runnerRoot, "externals", "node12", "bin", $"node{IOUtil.ExeExtension}"); string node = Path.Combine(runnerRoot, "externals", "node12", "bin", $"node{IOUtil.ExeExtension}");

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>net6</TargetFramework>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64</RuntimeIdentifiers> <RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64</RuntimeIdentifiers>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch> <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>

View File

@@ -28,14 +28,6 @@ namespace GitHub.Services.Common
} }
} }
public IDictionary<string, object> Properties
{
get
{
return m_request.Properties;
}
}
IEnumerable<String> IHttpHeaders.GetValues(String name) IEnumerable<String> IHttpHeaders.GetValues(String name)
{ {
IEnumerable<String> values; IEnumerable<String> values;

View File

@@ -14,10 +14,5 @@ namespace GitHub.Services.Common
{ {
get; get;
} }
IDictionary<string, object> Properties
{
get;
}
} }
} }

View File

@@ -20,12 +20,11 @@ namespace GitHub.Services.Common.Diagnostics
public static VssTraceActivity GetActivity(this HttpRequestMessage message) public static VssTraceActivity GetActivity(this HttpRequestMessage message)
{ {
Object traceActivity; if (!message.Options.TryGetValue(VssTraceActivity.PropertyName, out VssTraceActivity traceActivity))
if (!message.Properties.TryGetValue(VssTraceActivity.PropertyName, out traceActivity))
{ {
return VssTraceActivity.Empty; return VssTraceActivity.Empty;
} }
return (VssTraceActivity)traceActivity; return traceActivity;
} }
} }
} }

View File

@@ -1,6 +1,7 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Runtime.Serialization; using System.Runtime.Serialization;
using System.Net.Http;
namespace GitHub.Services.Common.Diagnostics namespace GitHub.Services.Common.Diagnostics
{ {
@@ -98,7 +99,7 @@ namespace GitHub.Services.Common.Diagnostics
/// <summary> /// <summary>
/// Gets the property name used to cache this object on extensible objects. /// Gets the property name used to cache this object on extensible objects.
/// </summary> /// </summary>
public const String PropertyName = "MS.VSS.Diagnostics.TraceActivity"; public static readonly HttpRequestOptionsKey<VssTraceActivity> PropertyName = new HttpRequestOptionsKey<VssTraceActivity>("MS.VSS.Diagnostics.TraceActivity");
private static Lazy<VssTraceActivity> s_empty = new Lazy<VssTraceActivity>(() => new VssTraceActivity(Guid.Empty)); private static Lazy<VssTraceActivity> s_empty = new Lazy<VssTraceActivity>(() => new VssTraceActivity(Guid.Empty));
private sealed class CorrelationScope : IDisposable private sealed class CorrelationScope : IDisposable

View File

@@ -110,7 +110,7 @@ namespace GitHub.Services.Common
} }
} }
internal static readonly String PropertyName = "MS.VS.MessageHandler"; internal static readonly HttpRequestOptionsKey<VssHttpMessageHandler> PropertyName = new HttpRequestOptionsKey<VssHttpMessageHandler>("MS.VS.MessageHandler");
/// <summary> /// <summary>
/// Handles the authentication hand-shake for a Visual Studio service. /// Handles the authentication hand-shake for a Visual Studio service.
@@ -169,7 +169,7 @@ namespace GitHub.Services.Common
} }
// Add ourselves to the message so the underlying token issuers may use it if necessary // Add ourselves to the message so the underlying token issuers may use it if necessary
request.Properties[VssHttpMessageHandler.PropertyName] = this; request.Options.Set(VssHttpMessageHandler.PropertyName, this);
Boolean succeeded = false; Boolean succeeded = false;
Boolean lastResponseDemandedProxyAuth = false; Boolean lastResponseDemandedProxyAuth = false;
@@ -409,7 +409,7 @@ namespace GitHub.Services.Common
// Read the completion option provided by the caller. If we don't find the property then we // Read the completion option provided by the caller. If we don't find the property then we
// assume it is OK to buffer by default. // assume it is OK to buffer by default.
HttpCompletionOption completionOption; HttpCompletionOption completionOption;
if (!request.Properties.TryGetValue(VssHttpRequestSettings.HttpCompletionOptionPropertyName, out completionOption)) if (!request.Options.TryGetValue(VssHttpRequestSettings.HttpCompletionOptionPropertyName, out completionOption))
{ {
completionOption = HttpCompletionOption.ResponseContentRead; completionOption = HttpCompletionOption.ResponseContentRead;
} }

View File

@@ -11,7 +11,7 @@ namespace GitHub.Services.Common
{ {
DateTime _lastTime; DateTime _lastTime;
static readonly String TfsTraceInfoKey = "TFS_TraceInfo"; private static readonly HttpRequestOptionsKey<VssHttpMessageHandlerTraceInfo> TfsTraceInfoKey = new HttpRequestOptionsKey<VssHttpMessageHandlerTraceInfo>("TFS_TraceInfo");
public int TokenRetries { get; internal set; } public int TokenRetries { get; internal set; }
@@ -76,10 +76,9 @@ namespace GitHub.Services.Common
/// <param name="traceInfo"></param> /// <param name="traceInfo"></param>
public static void SetTraceInfo(HttpRequestMessage message, VssHttpMessageHandlerTraceInfo traceInfo) public static void SetTraceInfo(HttpRequestMessage message, VssHttpMessageHandlerTraceInfo traceInfo)
{ {
object existingTraceInfo; if (!message.Options.TryGetValue(TfsTraceInfoKey, out var _))
if (!message.Properties.TryGetValue(TfsTraceInfoKey, out existingTraceInfo))
{ {
message.Properties.Add(TfsTraceInfoKey, traceInfo); message.Options.Set(TfsTraceInfoKey, traceInfo);
} }
} }
@@ -90,13 +89,8 @@ namespace GitHub.Services.Common
/// <returns></returns> /// <returns></returns>
public static VssHttpMessageHandlerTraceInfo GetTraceInfo(HttpRequestMessage message) public static VssHttpMessageHandlerTraceInfo GetTraceInfo(HttpRequestMessage message)
{ {
VssHttpMessageHandlerTraceInfo traceInfo = null; VssHttpMessageHandlerTraceInfo traceInfo;
message.Options.TryGetValue(TfsTraceInfoKey, out traceInfo);
if (message.Properties.TryGetValue(TfsTraceInfoKey, out object traceInfoObject))
{
traceInfo = traceInfoObject as VssHttpMessageHandlerTraceInfo;
}
return traceInfo; return traceInfo;
} }

View File

@@ -291,12 +291,12 @@ namespace GitHub.Services.Common
protected internal virtual Boolean ApplyTo(HttpRequestMessage request) protected internal virtual Boolean ApplyTo(HttpRequestMessage request)
{ {
// Make sure we only apply the settings to the request once // Make sure we only apply the settings to the request once
if (request.Properties.ContainsKey(PropertyName)) if (request.Options.TryGetValue(PropertyName, out var _))
{ {
return false; return false;
} }
request.Properties.Add(PropertyName, this); request.Options.Set(PropertyName, this);
if (this.AcceptLanguages != null && this.AcceptLanguages.Count > 0) if (this.AcceptLanguages != null && this.AcceptLanguages.Count > 0)
{ {
@@ -366,12 +366,12 @@ namespace GitHub.Services.Common
/// <summary> /// <summary>
/// Gets the property name used to reference this object. /// Gets the property name used to reference this object.
/// </summary> /// </summary>
public const String PropertyName = "MS.VS.RequestSettings"; public static readonly HttpRequestOptionsKey<VssHttpRequestSettings> PropertyName = new HttpRequestOptionsKey<VssHttpRequestSettings>("MS.VS.RequestSettings");
/// <summary> /// <summary>
/// Gets the property name used to reference the completion option for a specific request. /// Gets the property name used to reference the completion option for a specific request.
/// </summary> /// </summary>
public const String HttpCompletionOptionPropertyName = "MS.VS.HttpCompletionOption"; public static readonly HttpRequestOptionsKey<HttpCompletionOption> HttpCompletionOptionPropertyName = new HttpRequestOptionsKey<HttpCompletionOption>("MS.VS.HttpCompletionOption");
/// <summary> /// <summary>
/// Header to include the light weight response client option. /// Header to include the light weight response client option.

View File

@@ -53,23 +53,14 @@ namespace GitHub.Services.Common
VssTraceActivity traceActivity = VssTraceActivity.Current; VssTraceActivity traceActivity = VssTraceActivity.Current;
// Allow overriding default retry options per request // Allow overriding default retry options per request
VssHttpRetryOptions retryOptions = m_retryOptions; VssHttpRetryOptions retryOptions;
object retryOptionsObject; request.Options.TryGetValue(HttpRetryOptionsKey, out retryOptions);
if (request.Properties.TryGetValue(HttpRetryOptionsKey, out retryOptionsObject)) // NETSTANDARD compliant, TryGetValue<T> is not
{
// Fallback to default options if object of unexpected type was passed
retryOptions = retryOptionsObject as VssHttpRetryOptions ?? m_retryOptions;
}
TimeSpan minBackoff = retryOptions.MinBackoff; TimeSpan minBackoff = (retryOptions ?? m_retryOptions).MinBackoff;
Int32 maxAttempts = retryOptions.MaxRetries + 1; Int32 maxAttempts = (retryOptions ?? m_retryOptions).MaxRetries + 1;
IVssHttpRetryInfo retryInfo = null; IVssHttpRetryInfo retryInfo = null;
object retryInfoObject; request.Options.TryGetValue(HttpRetryInfoKey, out retryInfo);
if (request.Properties.TryGetValue(HttpRetryInfoKey, out retryInfoObject)) // NETSTANDARD compliant, TryGetValue<T> is not
{
retryInfo = retryInfoObject as IVssHttpRetryInfo;
}
if (IsLowPriority(request)) if (IsLowPriority(request))
{ {
@@ -225,8 +216,8 @@ namespace GitHub.Services.Common
} }
private VssHttpRetryOptions m_retryOptions; private VssHttpRetryOptions m_retryOptions;
public const string HttpRetryInfoKey = "HttpRetryInfo"; public static readonly HttpRequestOptionsKey<IVssHttpRetryInfo> HttpRetryInfoKey = new HttpRequestOptionsKey<IVssHttpRetryInfo>("HttpRetryInfo");
public const string HttpRetryOptionsKey = "VssHttpRetryOptions"; public static readonly HttpRequestOptionsKey<VssHttpRetryOptions> HttpRetryOptionsKey = new HttpRequestOptionsKey<VssHttpRetryOptions>("VssHttpRetryOptions");
private string m_clientName = ""; private string m_clientName = "";
} }
} }

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>net6</TargetFramework>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64</RuntimeIdentifiers> <RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64</RuntimeIdentifiers>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch> <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>

View File

@@ -833,7 +833,7 @@ namespace GitHub.Services.WebApi
{ {
if (userState != null) if (userState != null)
{ {
message.Properties[UserStatePropertyName] = userState; message.Options.Set(UserStatePropertyName, userState);
} }
if (!message.Headers.Contains(Common.Internal.HttpHeaders.VssE2EID)) if (!message.Headers.Contains(Common.Internal.HttpHeaders.VssE2EID))
@@ -842,11 +842,11 @@ namespace GitHub.Services.WebApi
} }
VssHttpEventSource.Log.HttpRequestStart(traceActivity, message); VssHttpEventSource.Log.HttpRequestStart(traceActivity, message);
message.Trace(); message.Trace();
message.Properties[VssTraceActivity.PropertyName] = traceActivity; message.Options.Set(VssTraceActivity.PropertyName, traceActivity);
// Send the completion option to the inner handler stack so we know when it's safe to buffer // Send the completion option to the inner handler stack so we know when it's safe to buffer
// and when we should avoid buffering. // and when we should avoid buffering.
message.Properties[VssHttpRequestSettings.HttpCompletionOptionPropertyName] = completionOption; message.Options.Set(VssHttpRequestSettings.HttpCompletionOptionPropertyName, completionOption);
//ConfigureAwait(false) enables the continuation to be run outside //ConfigureAwait(false) enables the continuation to be run outside
//any captured SyncronizationContext (such as ASP.NET's) which keeps things //any captured SyncronizationContext (such as ASP.NET's) which keeps things
@@ -1154,7 +1154,9 @@ namespace GitHub.Services.WebApi
{ {
if (BaseAddress != null) if (BaseAddress != null)
{ {
#pragma warning disable SYSLIB0014
ServicePoint servicePoint = ServicePointManager.FindServicePoint(BaseAddress); ServicePoint servicePoint = ServicePointManager.FindServicePoint(BaseAddress);
#pragma warning restore SYSLIB0014
servicePoint.UseNagleAlgorithm = false; servicePoint.UseNagleAlgorithm = false;
servicePoint.SetTcpKeepAlive( servicePoint.SetTcpKeepAlive(
enabled: true, enabled: true,
@@ -1272,7 +1274,7 @@ namespace GitHub.Services.WebApi
private const String c_jsonMediaType = "application/json"; private const String c_jsonMediaType = "application/json";
public readonly static String UserStatePropertyName = "VssClientBaseUserState"; public static readonly HttpRequestOptionsKey<object> UserStatePropertyName = new HttpRequestOptionsKey<object>("VssClientBaseUserState");
protected sealed class OperationScope : IDisposable protected sealed class OperationScope : IDisposable
{ {

View File

@@ -138,7 +138,7 @@ namespace GitHub.Services.WebApi
if (routeReplacementOptions.HasFlag(RouteReplacementOptions.EscapeUri)) if (routeReplacementOptions.HasFlag(RouteReplacementOptions.EscapeUri))
{ {
sbResult = new StringBuilder(Uri.EscapeUriString(sbResult.ToString())); sbResult = new StringBuilder(Uri.EscapeDataString(sbResult.ToString()));
} }
if (routeReplacementOptions.HasFlag(RouteReplacementOptions.AppendUnusedAsQueryParams) && unusedValues.Count > 0) if (routeReplacementOptions.HasFlag(RouteReplacementOptions.AppendUnusedAsQueryParams) && unusedValues.Count > 0)

View File

@@ -6,27 +6,24 @@ using System.Globalization;
using System.Linq; using System.Linq;
using System.Net.Http; using System.Net.Http;
using System.Net.Http.Headers; using System.Net.Http.Headers;
using System.Runtime.InteropServices;
namespace GitHub.Services.WebApi namespace GitHub.Services.WebApi
{ {
internal static class HttpMessageExtensions internal static class HttpMessageExtensions
{ {
private const string tracerKey = "VSS_HTTP_TIMER_TRACE"; private static readonly HttpRequestOptionsKey<VssRequestTimerTrace> tracerKey = new HttpRequestOptionsKey<VssRequestTimerTrace>("VSS_HTTP_TIMER_TRACE");
internal static void Trace(this HttpRequestMessage request) internal static void Trace(this HttpRequestMessage request)
{ {
Object tracerObj = null; VssRequestTimerTrace tracer;
VssRequestTimerTrace tracer = null; if (request.Options.TryGetValue(tracerKey, out tracer))
if (request.Properties.TryGetValue(tracerKey, out tracerObj))
{ {
tracer = tracerObj as VssRequestTimerTrace;
Debug.Assert(tracer != null, "Tracer object is the wrong type!"); Debug.Assert(tracer != null, "Tracer object is the wrong type!");
} }
else else
{ {
tracer = new VssRequestTimerTrace(); tracer = new VssRequestTimerTrace();
request.Properties[tracerKey] = tracer; request.Options.Set(tracerKey, tracer);
} }
if (tracer != null) if (tracer != null)
@@ -37,11 +34,9 @@ namespace GitHub.Services.WebApi
internal static void Trace(this HttpResponseMessage response) internal static void Trace(this HttpResponseMessage response)
{ {
Object tracerObj = null; VssRequestTimerTrace tracer;
VssRequestTimerTrace tracer = null; if (response.RequestMessage.Options.TryGetValue(tracerKey, out tracer))
if (response.RequestMessage.Properties.TryGetValue(tracerKey, out tracerObj))
{ {
tracer = tracerObj as VssRequestTimerTrace;
Debug.Assert(tracer != null, "Tracer object is the wrong type!"); Debug.Assert(tracer != null, "Tracer object is the wrong type!");
} }

View File

@@ -547,6 +547,7 @@ namespace GitHub.Runner.Common.Tests
} }
} }
#if OS_WINDOWS
[Fact] [Fact]
[Trait("Level", "L0")] [Trait("Level", "L0")]
[Trait("Category", nameof(CommandSettings))] [Trait("Category", nameof(CommandSettings))]
@@ -574,6 +575,7 @@ namespace GitHub.Runner.Common.Tests
Assert.Equal("some windows logon account", actual); Assert.Equal("some windows logon account", actual);
} }
} }
#endif
[Fact] [Fact]
[Trait("Level", "L0")] [Trait("Level", "L0")]

View File

@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>net6</TargetFramework>
<RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64</RuntimeIdentifiers> <RuntimeIdentifiers>win-x64;win-x86;linux-x64;linux-arm64;linux-arm;osx-x64</RuntimeIdentifiers>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch> <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<NoWarn>NU1701;NU1603;NU1603;xUnit2013;</NoWarn> <NoWarn>NU1701;NU1603;NU1603;xUnit2013;</NoWarn>

View File

@@ -14,10 +14,10 @@ DEV_TARGET_RUNTIME=$3
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
LAYOUT_DIR="$SCRIPT_DIR/../_layout" LAYOUT_DIR="$SCRIPT_DIR/../_layout"
DOWNLOAD_DIR="$SCRIPT_DIR/../_downloads/netcore2x" DOWNLOAD_DIR="$SCRIPT_DIR/../_downloads/net6"
PACKAGE_DIR="$SCRIPT_DIR/../_package" PACKAGE_DIR="$SCRIPT_DIR/../_package"
DOTNETSDK_ROOT="$SCRIPT_DIR/../_dotnetsdk" DOTNETSDK_ROOT="$SCRIPT_DIR/../_dotnetsdk"
DOTNETSDK_VERSION="3.1.302" DOTNETSDK_VERSION="6.0.100"
DOTNETSDK_INSTALLDIR="$DOTNETSDK_ROOT/$DOTNETSDK_VERSION" DOTNETSDK_INSTALLDIR="$DOTNETSDK_ROOT/$DOTNETSDK_VERSION"
RUNNER_VERSION=$(cat runnerversion) RUNNER_VERSION=$(cat runnerversion)

View File

@@ -1,5 +1,5 @@
{ {
"sdk": { "sdk": {
"version": "3.1.302" "version": "net6"
} }
} }