From cf4f299508ed9321ae85741c3b60d15b327c6c8e Mon Sep 17 00:00:00 2001 From: Thad House Date: Sun, 4 Aug 2024 21:26:27 -0700 Subject: [PATCH] Fix Roslyn Issues --- .../CodeHelpers.Test/CodeHelpers.Test.csproj | 18 +++++++++--------- .../LogGenerator/LogGeneratorFixerTest.cs | 5 ++--- .../LogGenerator/LogGeneratorTest.cs | 3 +-- .../LogGenerator/LogGeneratorTestVb.cs | 3 +-- codehelp/CodeHelpers/WPILib.CodeHelpers.csproj | 8 ++++---- src/wpiutil/Logging/DataLog.cs | 5 +++-- src/wpiutil/Logging/DataLogBackgroundWriter.cs | 6 ++++-- src/wpiutil/Logging/DataLogWriter.cs | 3 ++- 8 files changed, 26 insertions(+), 25 deletions(-) diff --git a/codehelp/CodeHelpers.Test/CodeHelpers.Test.csproj b/codehelp/CodeHelpers.Test/CodeHelpers.Test.csproj index 01b80f90..e8fffbd2 100644 --- a/codehelp/CodeHelpers.Test/CodeHelpers.Test.csproj +++ b/codehelp/CodeHelpers.Test/CodeHelpers.Test.csproj @@ -11,21 +11,21 @@ - - - - - - + + + + + + - - - + + + diff --git a/codehelp/CodeHelpers.Test/LogGenerator/LogGeneratorFixerTest.cs b/codehelp/CodeHelpers.Test/LogGenerator/LogGeneratorFixerTest.cs index 7a190d97..9de57e4d 100644 --- a/codehelp/CodeHelpers.Test/LogGenerator/LogGeneratorFixerTest.cs +++ b/codehelp/CodeHelpers.Test/LogGenerator/LogGeneratorFixerTest.cs @@ -1,12 +1,11 @@ using System.Text; using Microsoft.CodeAnalysis.CSharp.Testing; using Microsoft.CodeAnalysis.Testing; -using Microsoft.CodeAnalysis.Testing.Verifiers; using Microsoft.CodeAnalysis.Text; using Stereologue; using WPILib.CodeHelpers.LogGenerator.Analyzer; using WPILib.CodeHelpers.LogGenerator.CodeFixer; -using Verify = Microsoft.CodeAnalysis.CSharp.Testing.XUnit.CodeFixVerifier; +using Verify = Microsoft.CodeAnalysis.CSharp.Testing.CSharpCodeFixVerifier; namespace CodeHelpers.Test.LogGenerator; @@ -35,7 +34,7 @@ public partial class MyNewClass } "; - await new CSharpCodeFixTest() + await new CSharpCodeFixTest() { TestState = { AdditionalReferences = { diff --git a/codehelp/CodeHelpers.Test/LogGenerator/LogGeneratorTest.cs b/codehelp/CodeHelpers.Test/LogGenerator/LogGeneratorTest.cs index 91ec98a7..a7b31429 100644 --- a/codehelp/CodeHelpers.Test/LogGenerator/LogGeneratorTest.cs +++ b/codehelp/CodeHelpers.Test/LogGenerator/LogGeneratorTest.cs @@ -4,7 +4,6 @@ namespace CodeHelpers.Test.LogGenerator; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Testing; using Microsoft.CodeAnalysis.Testing; -using Microsoft.CodeAnalysis.Testing.Verifiers; using Microsoft.CodeAnalysis.Text; using Stereologue; using WPILib.CodeHelpers.LogGenerator.SourceGenerator; @@ -44,7 +43,7 @@ public void UpdateStereologue(string path, global::Stereologue.Stereologuer logg expected = expected.NormalizeLineEndings(); expected = expected.Replace("REPLACEME", output); - await new CSharpSourceGeneratorTest() + await new CSharpSourceGeneratorTest() { TestState = { AdditionalReferences = { diff --git a/codehelp/CodeHelpers.Test/LogGenerator/LogGeneratorTestVb.cs b/codehelp/CodeHelpers.Test/LogGenerator/LogGeneratorTestVb.cs index bf8852f1..02a6c6b9 100644 --- a/codehelp/CodeHelpers.Test/LogGenerator/LogGeneratorTestVb.cs +++ b/codehelp/CodeHelpers.Test/LogGenerator/LogGeneratorTestVb.cs @@ -3,7 +3,6 @@ namespace CodeHelpers.Test.LogGenerator; using System.Text; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Testing; -using Microsoft.CodeAnalysis.Testing.Verifiers; using Microsoft.CodeAnalysis.Text; using Microsoft.CodeAnalysis.VisualBasic.Testing; using Stereologue; @@ -44,7 +43,7 @@ End Class expected = expected.NormalizeLineEndings(); expected = expected.Replace("REPLACEME", output); - await new VisualBasicSourceGeneratorTest() + await new VisualBasicSourceGeneratorTest() { TestState = { AdditionalReferences = { diff --git a/codehelp/CodeHelpers/WPILib.CodeHelpers.csproj b/codehelp/CodeHelpers/WPILib.CodeHelpers.csproj index 61e0e901..b219acf4 100644 --- a/codehelp/CodeHelpers/WPILib.CodeHelpers.csproj +++ b/codehelp/CodeHelpers/WPILib.CodeHelpers.csproj @@ -22,9 +22,9 @@ - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive all @@ -32,7 +32,7 @@ - + diff --git a/src/wpiutil/Logging/DataLog.cs b/src/wpiutil/Logging/DataLog.cs index a8832d59..7375dd6c 100644 --- a/src/wpiutil/Logging/DataLog.cs +++ b/src/wpiutil/Logging/DataLog.cs @@ -8,7 +8,8 @@ namespace WPIUtil.Logging; public unsafe class DataLog : IDisposable { - protected DataLog(OpaqueDataLog* impl) { + protected DataLog(OpaqueDataLog* impl) + { NativeHandle = impl; } @@ -192,5 +193,5 @@ private void AddSchemaImpl(IStructBase value, long timestamp, HashSet se } private readonly ConcurrentDictionary m_schemaMap = []; - public unsafe OpaqueDataLog* NativeHandle { get; protected init;} + public unsafe OpaqueDataLog* NativeHandle { get; protected init; } } diff --git a/src/wpiutil/Logging/DataLogBackgroundWriter.cs b/src/wpiutil/Logging/DataLogBackgroundWriter.cs index eb7527bb..acfa5be2 100644 --- a/src/wpiutil/Logging/DataLogBackgroundWriter.cs +++ b/src/wpiutil/Logging/DataLogBackgroundWriter.cs @@ -21,7 +21,8 @@ private static void NativeDataLogCallback(void* ptr, byte* data, nuint len) public delegate void DataLogCallback(ReadOnlySpan data); - public DataLogBackgroundWriter(string dir = "", string filename = "", double period = 0.25, string extraHeader = "") : base(DataLogNative.CreateBg(dir, filename, period, extraHeader)) { + public DataLogBackgroundWriter(string dir = "", string filename = "", double period = 0.25, string extraHeader = "") : base(DataLogNative.CreateBg(dir, filename, period, extraHeader)) + { } @@ -35,7 +36,8 @@ public DataLogBackgroundWriter(DataLogCallback callback, double period = 0.25, s public override void Dispose() { base.Dispose(); - if (gcHandle.HasValue) { + if (gcHandle.HasValue) + { gcHandle.Value.Free(); } } diff --git a/src/wpiutil/Logging/DataLogWriter.cs b/src/wpiutil/Logging/DataLogWriter.cs index bcc846b9..8592ecb8 100644 --- a/src/wpiutil/Logging/DataLogWriter.cs +++ b/src/wpiutil/Logging/DataLogWriter.cs @@ -4,6 +4,7 @@ namespace WPIUtil.Logging; public unsafe class DataLogWriter : DataLog { - public DataLogWriter(string filename, string extraHeader = "") : base(DataLogNative.Create(filename, extraHeader)) { + public DataLogWriter(string filename, string extraHeader = "") : base(DataLogNative.Create(filename, extraHeader)) + { } }