Skip to content

Commit

Permalink
Update to .NET 8
Browse files Browse the repository at this point in the history
  • Loading branch information
lithiumtoast committed Nov 21, 2023
1 parent 86cdbd7 commit 0297b94
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
File renamed without changes.
12 changes: 6 additions & 6 deletions src/cs/Common/Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<!-- MSBuild settings -->
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>bottlenoselabs.Common</RootNamespace>
Expand All @@ -14,17 +14,17 @@
<IsPackable>true</IsPackable>
<PackageId>bottlenoselabs.Common</PackageId>
<PackageDescription>Common C# code across all C# projects at Bottlenose Labs.</PackageDescription>
<RepositoryUrl>https://github.com/bottlenoselabs/library-cs-Common</RepositoryUrl>
<RepositoryUrl>https://github.com/bottlenoselabs/Common</RepositoryUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
</PropertyGroup>

<!-- NuGet package references -->
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2023.2.0"/>
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0-preview.7.23375.6"/>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0-preview.7.23375.6"/>
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0"/>
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0"/>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0"/>
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1"/>
<PackageReference Include="System.IO.Abstractions" Version="19.2.69"/>
<PackageReference Include="System.IO.Abstractions" Version="19.2.87"/>
</ItemGroup>

</Project>
11 changes: 6 additions & 5 deletions src/cs/Common/Tools/Tool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ public abstract class Tool<TUnsanitizedInput, TInput, TOutput> : Tool
private IDisposable? _loggerScopeStep;
private readonly IFileSystem _fileSystem;

private JsonSerializerOptions _jsonSerializerOptions = new JsonSerializerOptions()
{
AllowTrailingCommas = true
};

protected Tool(
ILogger<Tool<TUnsanitizedInput, TInput, TOutput>> logger,
ToolInputSanitizer<TUnsanitizedInput, TInput> inputSanitizer,
Expand Down Expand Up @@ -59,11 +64,7 @@ public TOutput Run(string configurationFilePath)
throw new ToolInputSanitizationException($"The extract options file '{fullFilePath}' is empty.");
}

var serializerOptions = new JsonSerializerOptions
{
AllowTrailingCommas = true
};
var unsanitizedInput = JsonSerializer.Deserialize<TUnsanitizedInput>(fileContents, serializerOptions);
var unsanitizedInput = JsonSerializer.Deserialize<TUnsanitizedInput>(fileContents, _jsonSerializerOptions);
if (unsanitizedInput == null)
{
throw new ToolInputSanitizationException("Failed to deserialize the tool configuration file path.");
Expand Down

0 comments on commit 0297b94

Please sign in to comment.