Skip to content

Commit

Permalink
Fix Roslyn Issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ThadHouse committed Aug 5, 2024
1 parent 6db0ff8 commit cf4f299
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 25 deletions.
18 changes: 9 additions & 9 deletions codehelp/CodeHelpers.Test/CodeHelpers.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing.XUnit" Version="1.1.2-beta1.24121.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing.XUnit" Version="1.1.2-beta1.24121.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.XUnit" Version="1.1.2-beta1.24121.1" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic.CodeFix.Testing.XUnit" Version="1.1.2-beta1.24121.1" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic.SourceGenerators.Testing.XUnit" Version="1.1.2-beta1.24121.1" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic.Analyzer.Testing.XUnit" Version="1.1.2-beta1.24121.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing" Version="1.1.2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing" Version="1.1.2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing" Version="1.1.2" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic.CodeFix.Testing" Version="1.1.2" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic.SourceGenerators.Testing" Version="1.1.2" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic.Analyzer.Testing" Version="1.1.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.2" />
<ProjectReference Include="..\CodeHelpers\WPILib.CodeHelpers.csproj" />
<ProjectReference Include="..\..\src\stereologue\stereologue.csproj" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" Version="4.8.0" />
<PackageReference Include="Microsoft.CodeAnalysis" Version="4.8.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.10.0" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" Version="4.10.0" />
<PackageReference Include="Microsoft.CodeAnalysis" Version="4.10.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -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<WPILib.CodeHelpers.LogGenerator.Analyzer.LogGeneratorAnalyzer, WPILib.CodeHelpers.LogGenerator.CodeFixer.LogGeneratorFixer>;
using Verify = Microsoft.CodeAnalysis.CSharp.Testing.CSharpCodeFixVerifier<WPILib.CodeHelpers.LogGenerator.Analyzer.LogGeneratorAnalyzer, WPILib.CodeHelpers.LogGenerator.CodeFixer.LogGeneratorFixer, Microsoft.CodeAnalysis.Testing.DefaultVerifier>;

namespace CodeHelpers.Test.LogGenerator;

Expand Down Expand Up @@ -35,7 +34,7 @@ public partial class MyNewClass
}
";

await new CSharpCodeFixTest<LogGeneratorAnalyzer, LogGeneratorFixer, XUnitVerifier>()
await new CSharpCodeFixTest<LogGeneratorAnalyzer, LogGeneratorFixer, DefaultVerifier>()
{
TestState = {
AdditionalReferences = {
Expand Down
3 changes: 1 addition & 2 deletions codehelp/CodeHelpers.Test/LogGenerator/LogGeneratorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -44,7 +43,7 @@ public void UpdateStereologue(string path, global::Stereologue.Stereologuer logg
expected = expected.NormalizeLineEndings();
expected = expected.Replace("REPLACEME", output);

await new CSharpSourceGeneratorTest<LogGeneratorSharp, XUnitVerifier>()
await new CSharpSourceGeneratorTest<LogGeneratorSharp, DefaultVerifier>()
{
TestState = {
AdditionalReferences = {
Expand Down
3 changes: 1 addition & 2 deletions codehelp/CodeHelpers.Test/LogGenerator/LogGeneratorTestVb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -44,7 +43,7 @@ End Class
expected = expected.NormalizeLineEndings();
expected = expected.Replace("REPLACEME", output);

await new VisualBasicSourceGeneratorTest<LogGeneratorVb, XUnitVerifier>()
await new VisualBasicSourceGeneratorTest<LogGeneratorVb, DefaultVerifier>()
{
TestState = {
AdditionalReferences = {
Expand Down
8 changes: 4 additions & 4 deletions codehelp/CodeHelpers/WPILib.CodeHelpers.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@
<!-- Include enums used in attributes -->

<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" Version="4.8.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis" Version="4.8.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.10.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" Version="4.10.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis" Version="4.10.0" PrivateAssets="all" />
<PackageReference Include="PolySharp" Version="1.14.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<PackageReference Include="DotNet.ReproducibleBuilds" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="DotNet.ReproducibleBuilds" Version="1.2.4" PrivateAssets="All" />
</ItemGroup>

<!-- This ensures the library will be packaged as a source generator when we use `dotnet pack` -->
Expand Down
5 changes: 3 additions & 2 deletions src/wpiutil/Logging/DataLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ namespace WPIUtil.Logging;

public unsafe class DataLog : IDisposable
{
protected DataLog(OpaqueDataLog* impl) {
protected DataLog(OpaqueDataLog* impl)
{
NativeHandle = impl;
}

Expand Down Expand Up @@ -192,5 +193,5 @@ private void AddSchemaImpl(IStructBase value, long timestamp, HashSet<string> se
}

private readonly ConcurrentDictionary<string, int> m_schemaMap = [];
public unsafe OpaqueDataLog* NativeHandle { get; protected init;}
public unsafe OpaqueDataLog* NativeHandle { get; protected init; }
}
6 changes: 4 additions & 2 deletions src/wpiutil/Logging/DataLogBackgroundWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ private static void NativeDataLogCallback(void* ptr, byte* data, nuint len)

public delegate void DataLogCallback(ReadOnlySpan<byte> 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))
{

}

Expand All @@ -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();
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/wpiutil/Logging/DataLogWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
{
}
}

0 comments on commit cf4f299

Please sign in to comment.