From e7ca7bf5deefc2b32707f045c0c04f5a5abea2fa Mon Sep 17 00:00:00 2001 From: Michael Nebel Date: Mon, 25 Nov 2024 13:25:16 +0100 Subject: [PATCH 1/2] C#: Bazel build should target .NET9 framework. --- misc/bazel/csharp.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/bazel/csharp.bzl b/misc/bazel/csharp.bzl index be891b142f94..2ba8c59f0767 100644 --- a/misc/bazel/csharp.bzl +++ b/misc/bazel/csharp.bzl @@ -2,7 +2,7 @@ load("@rules_dotnet//dotnet:defs.bzl", "csharp_binary", "csharp_library", "cshar load("@rules_pkg//pkg:mappings.bzl", "strip_prefix") load("//misc/bazel:pkg.bzl", "codeql_pkg_files") -TARGET_FRAMEWORK = "net8.0" +TARGET_FRAMEWORK = "net9.0" def _gen_assembly_info(name): assembly_info_gen = name + "-assembly-info" From 199bfd11dadbbe560d7dc54143ea55ac4ce35e0e Mon Sep 17 00:00:00 2001 From: Michael Nebel Date: Mon, 25 Nov 2024 13:19:59 +0100 Subject: [PATCH 2/2] C#: Use dedicated lock type where applicable. --- .../NugetPackageRestorer.cs | 5 ++--- .../Semmle.Extraction.CSharp/Extractor/ExtractionContext.cs | 3 ++- csharp/extractor/Semmle.Util/Logging/PidStreamWriter.cs | 4 ++-- csharp/extractor/Testrunner/Testrunner.cs | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/NugetPackageRestorer.cs b/csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/NugetPackageRestorer.cs index 3895db3e4d40..f30760981f3a 100644 --- a/csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/NugetPackageRestorer.cs +++ b/csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/NugetPackageRestorer.cs @@ -4,7 +4,6 @@ using System.IO; using System.Linq; using System.Net.Http; -using System.Security.Cryptography; using System.Text; using System.Text.RegularExpressions; using System.Threading; @@ -264,7 +263,7 @@ private void RestoreProjects(IEnumerable projects, out ConcurrentBag { @@ -346,7 +345,7 @@ private void RestoreProjects(IEnumerable projects, out ConcurrentBag { diff --git a/csharp/extractor/Semmle.Extraction.CSharp/Extractor/ExtractionContext.cs b/csharp/extractor/Semmle.Extraction.CSharp/Extractor/ExtractionContext.cs index 619eb9953471..262475ca5a16 100644 --- a/csharp/extractor/Semmle.Extraction.CSharp/Extractor/ExtractionContext.cs +++ b/csharp/extractor/Semmle.Extraction.CSharp/Extractor/ExtractionContext.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Threading; using Semmle.Util.Logging; using CompilationInfo = (string key, string value); @@ -38,7 +39,7 @@ public ExtractionContext(string cwd, string[] args, string outputPath, IEnumerab // to handle pathological cases. private const int maxErrors = 1000; - private readonly object mutex = new object(); + private readonly Lock mutex = new(); public void Message(Message msg) { diff --git a/csharp/extractor/Semmle.Util/Logging/PidStreamWriter.cs b/csharp/extractor/Semmle.Util/Logging/PidStreamWriter.cs index 7d9599298d65..cf4d8be52e52 100644 --- a/csharp/extractor/Semmle.Util/Logging/PidStreamWriter.cs +++ b/csharp/extractor/Semmle.Util/Logging/PidStreamWriter.cs @@ -1,5 +1,5 @@ using System.IO; -using System.Diagnostics; +using System.Threading; namespace Semmle.Util.Logging { @@ -33,6 +33,6 @@ public override void WriteLine(string? format, params object?[] args) WriteLine(format is null ? format : string.Format(format, args)); } - private readonly object mutex = new object(); + private readonly Lock mutex = new(); } } diff --git a/csharp/extractor/Testrunner/Testrunner.cs b/csharp/extractor/Testrunner/Testrunner.cs index 6280a8c1be2a..d772ca903f7a 100644 --- a/csharp/extractor/Testrunner/Testrunner.cs +++ b/csharp/extractor/Testrunner/Testrunner.cs @@ -14,7 +14,7 @@ /// public class Testrunner { - private static readonly object ConsoleLock = new(); + private static readonly Lock ConsoleLock = new(); private static readonly ManualResetEvent Finished = new(false);