mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-11 05:52:19 +02:00
[PreviewPane] Enable analyzer and fix warnings (#16995)
This commit is contained in:
committed by
GitHub
parent
bf3e427017
commit
7365ba14d0
@@ -3,6 +3,7 @@
|
|||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using Common;
|
||||||
using Microsoft.PowerToys.STATestExtension;
|
using Microsoft.PowerToys.STATestExtension;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
using PreviewHandlerCommon;
|
using PreviewHandlerCommon;
|
||||||
|
|||||||
@@ -18,6 +18,8 @@
|
|||||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||||
|
<EnableNETAnalyzers>true</EnableNETAnalyzers>
|
||||||
|
<AnalysisMode>Recommended</AnalysisMode>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ namespace Common.Utilities
|
|||||||
|
|
||||||
if (buffer == null)
|
if (buffer == null)
|
||||||
{
|
{
|
||||||
throw new NullReferenceException("buffer is null");
|
throw new ArgumentNullException(nameof(buffer), "buffer is null");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (offset < 0 || count < 0 || (offset + count) > buffer.Length)
|
if (offset < 0 || count < 0 || (offset + count) > buffer.Length)
|
||||||
|
|||||||
@@ -4,14 +4,16 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
/// <summary>
|
namespace Common
|
||||||
/// Flags to control download and execution in Web Browser Control.
|
|
||||||
/// Values of flags are defined in mshtmdid.h in distributed Windows Sdk.
|
|
||||||
/// </summary>
|
|
||||||
[Flags]
|
|
||||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "Interop, keeping stuff in sync")]
|
|
||||||
public enum WebBrowserDownloadControlFlags : int
|
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Flags to control download and execution in Web Browser Control.
|
||||||
|
/// Values of flags are defined in mshtmdid.h in distributed Windows Sdk.
|
||||||
|
/// </summary>
|
||||||
|
[Flags]
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "Interop, keeping stuff in sync")]
|
||||||
|
public enum WebBrowserDownloadControlFlags : int
|
||||||
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Images will be downloaded from the server if this flag is set.
|
/// Images will be downloaded from the server if this flag is set.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -106,4 +108,5 @@ public enum WebBrowserDownloadControlFlags : int
|
|||||||
/// No user interface will be displayed during downloads.
|
/// No user interface will be displayed during downloads.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
SILENT = 0x40000000,
|
SILENT = 0x40000000,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using System;
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using Common;
|
||||||
|
|
||||||
namespace PreviewHandlerCommon
|
namespace PreviewHandlerCommon
|
||||||
{
|
{
|
||||||
@@ -52,7 +53,7 @@ namespace PreviewHandlerCommon
|
|||||||
{
|
{
|
||||||
object result;
|
object result;
|
||||||
|
|
||||||
if (name != null && name.Equals(DISPIDAMBIENTDLCONTROL, StringComparison.CurrentCulture))
|
if (name != null && name.Equals(DISPIDAMBIENTDLCONTROL, StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
// Using InvariantCulture since this is used for web browser configurations
|
// Using InvariantCulture since this is used for web browser configurations
|
||||||
result = Convert.ToInt32(
|
result = Convert.ToInt32(
|
||||||
|
|||||||
Reference in New Issue
Block a user