diff --git a/src/common/ManagedCommon/ManagedCommon.csproj b/src/common/ManagedCommon/ManagedCommon.csproj index 24a0f95a41..f090498f29 100644 --- a/src/common/ManagedCommon/ManagedCommon.csproj +++ b/src/common/ManagedCommon/ManagedCommon.csproj @@ -35,5 +35,21 @@ - + + + StyleCop.json + + + + + 1.1.118 + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + GlobalSuppressions.cs + + diff --git a/src/common/ManagedCommon/NativeMethods.cs b/src/common/ManagedCommon/NativeMethods.cs index ff556351cb..1b7a081367 100644 --- a/src/common/ManagedCommon/NativeMethods.cs +++ b/src/common/ManagedCommon/NativeMethods.cs @@ -1,4 +1,8 @@ -using System; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; using System.Runtime.InteropServices; namespace ManagedCommon diff --git a/src/common/ManagedCommon/RunnerHelper.cs b/src/common/ManagedCommon/RunnerHelper.cs index ab074bc387..6c4a0cbf5b 100644 --- a/src/common/ManagedCommon/RunnerHelper.cs +++ b/src/common/ManagedCommon/RunnerHelper.cs @@ -1,11 +1,13 @@ -using Microsoft.PowerToys.Telemetry; -using Microsoft.PowerToys.Telemetry.Events; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + using System; -using System.Collections.Generic; using System.Diagnostics; using System.Reflection; -using System.Text; using System.Threading.Tasks; +using Microsoft.PowerToys.Telemetry; +using Microsoft.PowerToys.Telemetry.Events; namespace ManagedCommon { diff --git a/src/common/ManagedTelemetry/Telemetry/Events/DebugEvent.cs b/src/common/ManagedTelemetry/Telemetry/Events/DebugEvent.cs index 170670eeb6..da15a90319 100644 --- a/src/common/ManagedTelemetry/Telemetry/Events/DebugEvent.cs +++ b/src/common/ManagedTelemetry/Telemetry/Events/DebugEvent.cs @@ -1,7 +1,8 @@ -using System; -using System.Collections.Generic; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + using System.Diagnostics.Tracing; -using System.Text; namespace Microsoft.PowerToys.Telemetry.Events { @@ -9,6 +10,7 @@ namespace Microsoft.PowerToys.Telemetry.Events public class DebugEvent : EventBase, IEvent { public string Message { get; set; } + public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServicePerformance; } } diff --git a/src/common/ManagedTelemetry/Telemetry/Events/EventBase.cs b/src/common/ManagedTelemetry/Telemetry/Events/EventBase.cs index 2262aa7485..338dbdeb56 100644 --- a/src/common/ManagedTelemetry/Telemetry/Events/EventBase.cs +++ b/src/common/ManagedTelemetry/Telemetry/Events/EventBase.cs @@ -1,13 +1,15 @@ -using System; -using System.Collections.Generic; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; using System.Diagnostics.Tracing; using System.Reflection; -using System.Text; namespace Microsoft.PowerToys.Telemetry.Events { /// - /// A base class to implement properties that are common to all telemetry events. + /// A base class to implement properties that are common to all telemetry events. /// [EventData] public class EventBase @@ -15,6 +17,7 @@ namespace Microsoft.PowerToys.Telemetry.Events public bool UTCReplace_AppSessionGuid => true; private string _version; + public string Version { get @@ -23,13 +26,14 @@ namespace Microsoft.PowerToys.Telemetry.Events { _version = GetVersionFromAssembly(); } + return _version; } } private string GetVersionFromAssembly() { - // For consistency this should be formatted the same way as + // For consistency this should be formatted the same way as // https://github.com/microsoft/PowerToys/blob/710f92d99965109fd788d85ebf8b6b9e0ba1524a/src/common/common.cpp#L635 var version = Assembly.GetExecutingAssembly()?.GetName()?.Version ?? new Version(); return $"v{version.Major}.{version.Minor}.{version.Build}"; diff --git a/src/common/ManagedTelemetry/Telemetry/Events/IEvent.cs b/src/common/ManagedTelemetry/Telemetry/Events/IEvent.cs index d4494c8f66..2b457566a3 100644 --- a/src/common/ManagedTelemetry/Telemetry/Events/IEvent.cs +++ b/src/common/ManagedTelemetry/Telemetry/Events/IEvent.cs @@ -1,6 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Text; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. namespace Microsoft.PowerToys.Telemetry.Events { diff --git a/src/common/ManagedTelemetry/Telemetry/PowerToysTelemetry.cs b/src/common/ManagedTelemetry/Telemetry/PowerToysTelemetry.cs index 5a25d7a9c9..0253f8e64b 100644 --- a/src/common/ManagedTelemetry/Telemetry/PowerToysTelemetry.cs +++ b/src/common/ManagedTelemetry/Telemetry/PowerToysTelemetry.cs @@ -2,9 +2,8 @@ // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.PowerToys.Telemetry.Events; using System.Diagnostics.Tracing; - +using Microsoft.PowerToys.Telemetry.Events; namespace Microsoft.PowerToys.Telemetry { @@ -13,7 +12,6 @@ namespace Microsoft.PowerToys.Telemetry /// public class PowerToysTelemetry : TelemetryBase { - /// /// Name for ETW event. /// @@ -30,20 +28,22 @@ namespace Microsoft.PowerToys.Telemetry /// /// Gets an instance of the class. /// - public static PowerToysTelemetry Log = new PowerToysTelemetry(); + public static PowerToysTelemetry Log { get; } = new PowerToysTelemetry(); /// - /// Publishes ETW event when an action is triggered on + /// Publishes ETW event when an action is triggered on /// public void WriteEvent(T telemetryEvent) where T : EventBase, IEvent { - this.Write(null, new EventSourceOptions() - { - Keywords = ProjectKeywordMeasure, - Tags = ProjectTelemetryTagProductAndServicePerformance, - }, - telemetryEvent); + this.Write( + null, + new EventSourceOptions() + { + Keywords = ProjectKeywordMeasure, + Tags = ProjectTelemetryTagProductAndServicePerformance, + }, + telemetryEvent); } } } diff --git a/src/common/ManagedTelemetry/Telemetry/Telemetry.csproj b/src/common/ManagedTelemetry/Telemetry/Telemetry.csproj index 14514112ba..82789805e9 100644 --- a/src/common/ManagedTelemetry/Telemetry/Telemetry.csproj +++ b/src/common/ManagedTelemetry/Telemetry/Telemetry.csproj @@ -19,5 +19,21 @@ - + + + StyleCop.json + + + + + 1.1.118 + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + GlobalSuppressions.cs + +