Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CA1051: Do not declare visible instance fields #3859

Merged
merged 1 commit into from
Jul 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ dotnet_diagnostic.CA1816.severity = warning # not default, increased severity to
# CA1018: Mark attributes with AttributeUsageAttribute
dotnet_diagnostic.CA1018.severity = warning # not default, increased severity to ensure it is applied

# CA1051: Do not declare visible instance fields
dotnet_diagnostic.CA1051.severity = warning # not default, increased severity to ensure it is applied

#### C# Coding Conventions ####

# var preferences
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ public class DesignModeClient : IDesignModeClient
private readonly IEnvironment _platformEnvironment;
private readonly TestSessionMessageLogger _testSessionMessageLogger;
private readonly object _lockObject = new();
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Part of the public API.")]
[SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Part of the public API.")]
[SuppressMessage("Design", "CA1051:Do not declare visible instance fields", Justification = "Part of the public API")]
protected Action<Message>? onCustomTestHostLaunchAckReceived;
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Part of the public API.")]
[SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Part of the public API.")]
[SuppressMessage("Design", "CA1051:Do not declare visible instance fields", Justification = "Part of the public API")]
protected Action<Message>? onAttachDebuggerAckRecieved;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.Serialization;

namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger.ObjectModel;
Expand All @@ -10,6 +11,7 @@ namespace Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger.ObjectModel;
/// It stores the all relevant information of the test run.
/// </summary>
[DataContract]
[SuppressMessage("Design", "CA1051:Do not declare visible instance fields", Justification = "Part of the public API")]
public sealed class TestRunDetails
{
/// <summary>
Expand Down
3 changes: 3 additions & 0 deletions test/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ dotnet_diagnostic.CA1018.severity = warning
# CA1001: Types that own disposable fields should be disposable
dotnet_diagnostic.CA1001.severity = silent # Disabled on tests as it does not matter

# CA1051: Do not declare visible instance fields
dotnet_diagnostic.CA1051.severity = silent # Disabled on tests as it does not matter

#### C# Coding Conventions ####

#### .NET Formatting Rules ####
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Microsoft.TestPlatform.TestUtilities;

public class TestableTestPluginCache : TestPluginCache
{
public Action? Action;
public Action? Action { get; set; }

public TestableTestPluginCache(List<string> extensionsPath)
{
Expand Down