From 2aa5b1cdd7a127d2b588613f702b7d4137504ced Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 9 Mar 2026 23:13:08 +0000 Subject: [PATCH 1/3] Initial plan From 462b19ef36c0c88b73d35dadb9c9e53315c3cd5f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 9 Mar 2026 23:14:31 +0000 Subject: [PATCH 2/3] plan: fix null handling consistency in BanImplicitDateTimeToDateTimeOffsetConversion Co-authored-by: BenjaminMichaelis <22186029+BenjaminMichaelis@users.noreply.github.com> --- Directory.Packages.props | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 09f7d64c..3972d979 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -1,20 +1,20 @@ - - - true - false - - - - - - - - - - - - - - - - + + + true + false + + + + + + + + + + + + + + + + From df5ac2c51e471285930d163532ba7fa25a163d43 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 9 Mar 2026 23:27:16 +0000 Subject: [PATCH 3/3] fix: use null checks in AnalyzeObjectCreation for consistency with AnalyzeInvocation Co-authored-by: BenjaminMichaelis <22186029+BenjaminMichaelis@users.noreply.github.com> --- .../BanImplicitDateTimeToDateTimeOffsetConversion.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/IntelliTect.Analyzer/IntelliTect.Analyzer/Analyzers/BanImplicitDateTimeToDateTimeOffsetConversion.cs b/IntelliTect.Analyzer/IntelliTect.Analyzer/Analyzers/BanImplicitDateTimeToDateTimeOffsetConversion.cs index 728d3521..ed81f2ea 100644 --- a/IntelliTect.Analyzer/IntelliTect.Analyzer/Analyzers/BanImplicitDateTimeToDateTimeOffsetConversion.cs +++ b/IntelliTect.Analyzer/IntelliTect.Analyzer/Analyzers/BanImplicitDateTimeToDateTimeOffsetConversion.cs @@ -59,10 +59,12 @@ private void AnalyzeObjectCreation(OperationAnalysisContext context) return; } - INamedTypeSymbol dateTimeOffsetType = context.Compilation.GetTypeByMetadataName("System.DateTimeOffset") - ?? throw new InvalidOperationException("Unable to find DateTimeOffset type"); - INamedTypeSymbol dateTimeType = context.Compilation.GetTypeByMetadataName("System.DateTime") - ?? throw new InvalidOperationException("Unable to find DateTime type"); + INamedTypeSymbol? dateTimeOffsetType = context.Compilation.GetTypeByMetadataName("System.DateTimeOffset"); + INamedTypeSymbol? dateTimeType = context.Compilation.GetTypeByMetadataName("System.DateTime"); + if (dateTimeOffsetType is null || dateTimeType is null) + { + return; + } // Check if we're creating a DateTimeOffset if (!SymbolEqualityComparer.Default.Equals(objectCreation.Type, dateTimeOffsetType))