summaryrefslogtreecommitdiff
path: root/app-shells/pwsh/files/pwsh-7.4.0-disable-telemetry.patch
blob: 49fdc34be8a2bccfd03c6d1b496bde3838e3ac02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
--- a/src/System.Management.Automation/utils/Telemetry.cs
+++ b/src/System.Management.Automation/utils/Telemetry.cs
@@ -137,10 +137,10 @@ namespace Microsoft.PowerShell.Telemetry
         private static TelemetryClient s_telemetryClient { get; }
 
         // the unique identifier for the user, when we start we
-        private static string s_uniqueUserIdentifier { get; }
+        private static string s_uniqueUserIdentifier { get; } = string.Empty;
 
         // the session identifier
-        private static string s_sessionId { get; }
+        private static string s_sessionId { get; } = string.Empty;
 
         // private semaphore to determine whether we sent the startup telemetry event
         private static int s_startupEventSent = 0;
@@ -149,8 +149,8 @@ namespace Microsoft.PowerShell.Telemetry
         /// We send telemetry only a known set of modules and tags.
         /// If it's not in the list (initialized in the static constructor), then we report anonymous
         /// or don't report anything (in the case of tags).
-        private static readonly HashSet<string> s_knownModules;
-        private static readonly HashSet<string> s_knownModuleTags;
+        private static readonly HashSet<string> s_knownModules = new(){};
+        private static readonly HashSet<string> s_knownModuleTags = new(){};
 
         /// <summary>Gets a value indicating whether telemetry can be sent.</summary>
         public static bool CanSendTelemetry { get; private set; } = false;
--- a/src/System.Management.Automation/utils/Telemetry.cs
+++ b/src/System.Management.Automation/utils/Telemetry.cs
@@ -165,7 +165,8 @@ namespace Microsoft.PowerShell.Telemetry
         static ApplicationInsightsTelemetry()
         {
             // If we can't send telemetry, there's no reason to do any of this
-            CanSendTelemetry = !GetEnvironmentVariableAsBool(name: _telemetryOptoutEnvVar, defaultValue: false);
+            CanSendTelemetry = false;
+           /*
             if (CanSendTelemetry)
             {
                 s_sessionId = Guid.NewGuid().ToString();
@@ -617,6 +618,7 @@ namespace Microsoft.PowerShell.Telemetry
 
                 s_uniqueUserIdentifier = GetUniqueIdentifier().ToString();
             }
+           */
         }
 
         /// <summary>