mirror of
https://github.com/actions/runner.git
synced 2025-12-25 19:08:20 +08:00
Guard against NullReference while creating HostContext (#2343)
* Guard against NullReference while creating HostContext * Throw on IOUtil loading object if content is empty or object is null * removed unused dependency * Changed exceptions to ArgumentNullException and ArgumentException * fixed my mistake on LoadObject * fixed tests * trigger workflows * trigger workflows * encode files using utf8
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
@@ -220,7 +220,7 @@ namespace GitHub.Runner.Common
|
||||
var runnerFile = GetConfigFile(WellKnownConfigFile.Runner);
|
||||
if (File.Exists(runnerFile))
|
||||
{
|
||||
var runnerSettings = IOUtil.LoadObject<RunnerSettings>(runnerFile);
|
||||
var runnerSettings = IOUtil.LoadObject<RunnerSettings>(runnerFile, true);
|
||||
_userAgents.Add(new ProductInfoHeaderValue("RunnerId", runnerSettings.AgentId.ToString(CultureInfo.InvariantCulture)));
|
||||
_userAgents.Add(new ProductInfoHeaderValue("GroupId", runnerSettings.PoolId.ToString(CultureInfo.InvariantCulture)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user