mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 01:36:31 +02:00
[ImageResizer] Enable analyzer and fix warnings (#16512)
This commit is contained in:
committed by
GitHub
parent
6a722e2961
commit
2b747d02d3
@@ -20,6 +20,8 @@
|
||||
<Platform Condition="'$(Platform)'==''">x64</Platform>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<IntermediateOutputPath>$(SolutionDir)$(Platform)\$(Configuration)\obj\$(AssemblyName)\</IntermediateOutputPath>
|
||||
<EnableNETAnalyzers>true</EnableNETAnalyzers>
|
||||
<AnalysisMode>Recommended</AnalysisMode>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace ImageResizer.Models
|
||||
[TestMethod]
|
||||
public void ProcessAggregatesErrors()
|
||||
{
|
||||
var batch = CreateBatch(file => throw new Exception("Error: " + file));
|
||||
var batch = CreateBatch(file => throw new InvalidOperationException("Error: " + file));
|
||||
batch.Files.Add("Image1.jpg");
|
||||
batch.Files.Add("Image2.jpg");
|
||||
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<IntermediateOutputPath>$(SolutionDir)$(Platform)\$(Configuration)\obj\$(AssemblyName)\</IntermediateOutputPath>
|
||||
<EnableNETAnalyzers>true</EnableNETAnalyzers>
|
||||
<AnalysisMode>Recommended</AnalysisMode>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
// See the LICENSE file in the project root for more information. Code forked from Brice Lambson's https://github.com/bricelam/ImageResizer/
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
@@ -17,15 +16,15 @@ namespace ImageResizer.Properties
|
||||
}
|
||||
|
||||
public override JsonConverter CreateConverter(
|
||||
Type type,
|
||||
Type typeToConvert,
|
||||
JsonSerializerOptions options)
|
||||
{
|
||||
if (type == null)
|
||||
if (typeToConvert == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Type keyType = type.UnderlyingSystemType;
|
||||
Type keyType = typeToConvert.UnderlyingSystemType;
|
||||
|
||||
JsonConverter converter = (JsonConverter)Activator.CreateInstance(
|
||||
typeof(WrappedJsonConverter<>).MakeGenericType(keyType));
|
||||
|
||||
Reference in New Issue
Block a user