diff --git a/src/Agent/AutopilotMonitor.Agent.V2.Core.Tests/Monitoring/Ime/CmTraceLogParserTests.cs b/src/Agent/AutopilotMonitor.Agent.V2.Core.Tests/Monitoring/Ime/CmTraceLogParserTests.cs index 31f08753..82d135fc 100644 --- a/src/Agent/AutopilotMonitor.Agent.V2.Core.Tests/Monitoring/Ime/CmTraceLogParserTests.cs +++ b/src/Agent/AutopilotMonitor.Agent.V2.Core.Tests/Monitoring/Ime/CmTraceLogParserTests.cs @@ -107,6 +107,7 @@ namespace AutopilotMonitor.Agent.V2.Core.Tests.Monitoring.Ime var ok = CmTraceLogParser.TryParseLine(line, out var entry); Assert.True(ok); + Assert.NotNull(entry); Assert.Equal( new DateTime(2026, 7, 29, 11, 46, 19, DateTimeKind.Utc).AddTicks(226610).AddMinutes(expectedOffsetMinutes), entry.Timestamp); diff --git a/src/Agent/AutopilotMonitor.Agent.V2.Core.Tests/Program/TenantIdWaitResolutionTests.cs b/src/Agent/AutopilotMonitor.Agent.V2.Core.Tests/Program/TenantIdWaitResolutionTests.cs index 68fb4739..74bdb224 100644 --- a/src/Agent/AutopilotMonitor.Agent.V2.Core.Tests/Program/TenantIdWaitResolutionTests.cs +++ b/src/Agent/AutopilotMonitor.Agent.V2.Core.Tests/Program/TenantIdWaitResolutionTests.cs @@ -16,7 +16,7 @@ namespace AutopilotMonitor.Agent.V2.Core.Tests.Program /// public sealed class TenantIdWaitResolutionTests { - private static AgentConfiguration Build(BootstrapConfigFile bootstrapConfig, params string[] args) => + private static AgentConfiguration Build(BootstrapConfigFile? bootstrapConfig, params string[] args) => AutopilotMonitor.Agent.V2.Program.BuildAgentConfiguration( args: args, tenantId: "tenant-t", diff --git a/src/Backend/AutopilotMonitor.Functions.Tests/AutopilotMonitor.Functions.Tests.csproj b/src/Backend/AutopilotMonitor.Functions.Tests/AutopilotMonitor.Functions.Tests.csproj index 32243326..20060282 100644 --- a/src/Backend/AutopilotMonitor.Functions.Tests/AutopilotMonitor.Functions.Tests.csproj +++ b/src/Backend/AutopilotMonitor.Functions.Tests/AutopilotMonitor.Functions.Tests.csproj @@ -8,6 +8,11 @@ + + diff --git a/src/Backend/AutopilotMonitor.Functions/AutopilotMonitor.Functions.csproj b/src/Backend/AutopilotMonitor.Functions/AutopilotMonitor.Functions.csproj index a5c58f64..d42d34af 100644 --- a/src/Backend/AutopilotMonitor.Functions/AutopilotMonitor.Functions.csproj +++ b/src/Backend/AutopilotMonitor.Functions/AutopilotMonitor.Functions.csproj @@ -55,12 +55,6 @@ - - - diff --git a/src/Shared/AutopilotMonitor.Shared/AutopilotMonitor.Shared.csproj b/src/Shared/AutopilotMonitor.Shared/AutopilotMonitor.Shared.csproj index a0a7c241..f83e41aa 100644 --- a/src/Shared/AutopilotMonitor.Shared/AutopilotMonitor.Shared.csproj +++ b/src/Shared/AutopilotMonitor.Shared/AutopilotMonitor.Shared.csproj @@ -1,12 +1,16 @@  - netstandard2.0 + + netstandard2.0;net10.0 9.0 enable - + diff --git a/src/Shared/AutopilotMonitor.Shared/Logging/CmTraceLogParser.cs b/src/Shared/AutopilotMonitor.Shared/Logging/CmTraceLogParser.cs index 376ca077..fb6be85f 100644 --- a/src/Shared/AutopilotMonitor.Shared/Logging/CmTraceLogParser.cs +++ b/src/Shared/AutopilotMonitor.Shared/Logging/CmTraceLogParser.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Text.RegularExpressions; @@ -10,10 +11,10 @@ namespace AutopilotMonitor.Shared.Logging public class CmTraceLogEntry { public DateTime Timestamp { get; set; } - public string Message { get; set; } - public string Component { get; set; } + public string Message { get; set; } = string.Empty; + public string Component { get; set; } = string.Empty; public int Type { get; set; } // 1=Info, 2=Warning, 3=Error - public string Thread { get; set; } + public string Thread { get; set; } = string.Empty; } /// @@ -42,11 +43,12 @@ namespace AutopilotMonitor.Shared.Logging /// Attempts to parse a single line of CMTrace-formatted log. /// Returns true if parsing succeeded, false if the line doesn't match the format. /// - public static bool TryParseLine(string line, out CmTraceLogEntry entry) + public static bool TryParseLine(string? line, [NotNullWhen(true)] out CmTraceLogEntry? entry) { entry = null; - if (string.IsNullOrEmpty(line) || !line.StartsWith(" ReturnValue = returnValue; + + public bool ReturnValue { get; } + } +} +#endif diff --git a/src/Shared/AutopilotMonitor.Shared/Services/AgentEndpointMigrationRules.cs b/src/Shared/AutopilotMonitor.Shared/Services/AgentEndpointMigrationRules.cs index e0efd2f8..7adf4b1f 100644 --- a/src/Shared/AutopilotMonitor.Shared/Services/AgentEndpointMigrationRules.cs +++ b/src/Shared/AutopilotMonitor.Shared/Services/AgentEndpointMigrationRules.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics.CodeAnalysis; namespace AutopilotMonitor.Shared.Services { @@ -28,10 +29,9 @@ namespace AutopilotMonitor.Shared.Services /// normalized base URL (https://{lowercase-host}, no trailing slash) on success. /// Rules: absolute https URI, default port, no userinfo/path/query/fragment, host /// matching . is non-null - /// exactly when this returns true (netstandard2.0 has no usable - /// [NotNullWhen], so callers must check the bool themselves). + /// exactly when this returns true. /// - public static bool TryNormalizeTarget(string candidate, out string? normalized) + public static bool TryNormalizeTarget(string candidate, [NotNullWhen(true)] out string? normalized) { normalized = null;