diff --git a/Tools/CI/Recipes/MobileBaseRecipe.cs b/Tools/CI/Recipes/MobileBaseRecipe.cs index 0d8fbaea22..dd69563a47 100644 --- a/Tools/CI/Recipes/MobileBaseRecipe.cs +++ b/Tools/CI/Recipes/MobileBaseRecipe.cs @@ -53,7 +53,7 @@ protected string PrepareUtrExecutable(IJobBuilder job, SystemType systemType) { case SystemType.Android: // For build jobs on Android, we still use the built-in UTR and the extra commands are not needed. - if (job.Name.Contains("BuildJobs")) + if (job.Name != null && job.Name.Contains("BuildJobs")) break; job.WithCommands(Settings.AndroidExtraCommands).WithAfterCommands(Settings.AndroidExtraAfterCommands); job.WithCommands(UtrCommand.Download(systemType, "utr.bat")); diff --git a/Tools/CI/Recipes/Utilities/Utilities.cs b/Tools/CI/Recipes/Utilities/Utilities.cs index f717034307..093469e127 100644 --- a/Tools/CI/Recipes/Utilities/Utilities.cs +++ b/Tools/CI/Recipes/Utilities/Utilities.cs @@ -53,12 +53,18 @@ public static TEnum GetEnumValue(string value) where TEnum : Enum foreach (var field in type.GetFields()) { var attribute = field.GetCustomAttribute(); - if (attribute != null && attribute.Value == value) + + // Ensure both the attribute and its value match + if (attribute?.Value == value) { - return (TEnum)field.GetValue(null); + var val = field.GetValue(null); + if (val is TEnum result) + { + return result; + } } } - throw new ArgumentException($"No EnumMemberAttribute with value '{value}' found in enum '{type.Name}'."); + throw new ArgumentException($"Value '{value}' not found in {type.Name}."); } } \ No newline at end of file diff --git a/Tools/CI/Settings/InputSystemSettings.cs b/Tools/CI/Settings/InputSystemSettings.cs index 08b04bc810..f1e045e295 100644 --- a/Tools/CI/Settings/InputSystemSettings.cs +++ b/Tools/CI/Settings/InputSystemSettings.cs @@ -157,16 +157,16 @@ void ReadMobileConfig() } MobileBuildPlatforms.Add(platform, new Platform( - new Agent(v["build"]["image"].ToString(), - Utilities.GetEnumValue(v["build"]["flavor"].ToString()), - Utilities.GetEnumValue(v["build"]["type"].ToString())), + new Agent(v?["build"]?["image"]?.ToString() ?? string.Empty, + Utilities.GetEnumValue(v?["build"]?["flavor"]?.ToString() ?? string.Empty), + Utilities.GetEnumValue(v?["build"]?["type"]?.ToString() ?? string.Empty)), platform)); MobileTestPlatforms.Add(platform, new Platform( - new Agent(v["run"]["image"].ToString(), - Utilities.GetEnumValue(v["run"]["flavor"].ToString()), - Utilities.GetEnumValue(v["run"]["type"].ToString()), - v["run"]["model"]?.ToString()), + new Agent(v?["run"]?["image"]?.ToString() ?? string.Empty, + Utilities.GetEnumValue(v?["run"]?["flavor"]?.ToString() ?? string.Empty), + Utilities.GetEnumValue(v?["run"]?["type"]?.ToString() ?? string.Empty), + v?["run"]?["model"]?.ToString()), platform)); } }