Remove the use of Windows PowerShell ETW provider id and update PSDiagnostics module to work for PowerShell 7#25590
Conversation
…gnostics to work for PS7+
jborean93
left a comment
There was a problem hiding this comment.
I'm not really too familiar with the ETW side and the PSDiagnostics module but wouldn't this be a breaking change? Right now the PSDiagnostics module is importable in PS 7 and manages the WinPS provider. While I understand trying to keep the providers aligned with the PowerShell version used there could potentially be people using PS 7 to manage the WinPS provider in this module.
| /// </summary> | ||
| public const long KeywordAll = 0xFFFFFFFF; | ||
|
|
||
| private static readonly Guid providerId = Guid.Parse("a0c1853b-5c40-4b15-8766-3cf1c58f985a"); |
There was a problem hiding this comment.
Is there a reason why this doesn't use the PowerShellCore Provider ID f90714a8-5509-434a-bf6d-b1624c8a19a2 rather than just removing it?
There was a problem hiding this comment.
It is already there. It is inherited from EwtActivity.ProviderId (that is PSEtwLogProvider.ProviderGuid).
The (whole) code looks a bit confusing, though.
There was a problem hiding this comment.
This looks like an oversight when introducing the PowerShellCore provider initially in #5144.
The Tracer class is used in *-PSSessionConfiguration commands to write ETW logs like Endpoint registered/unregistered/modified/enabled/disabled. Today, those events are writting to the Windows PowerShell provider. The class is only used in ContainerParentJob.
The change to This module is shipped with PowerShell 7, so intuitively, running |
|
/azp run PowerShell-CI-linux-packaging, PowerShell-Windows-Packaging-CI |
|
Azure Pipelines could not run because the pipeline triggers exclude this branch/path. |
|
📣 Hey @@daxian-dbw, how did we do? We would love to hear your feedback with the link below! 🗣️ 🔗 https://aka.ms/PSRepoFeedback |
…agnostics` module to work for PowerShell 7 (PowerShell#25590)
PR Summary
This PR includes 2 changes to clean up the ETW logging related code in PowerShell:
a0c1853b-5c40-4b15-8766-3cf1c58f985a) in current code base. This seems to be an oversight from the initial effort to create manifest based ETW provider for PowerShell 7+ (Redirect ETW logging to Syslog on Linux #5144).PSDiagnosticsmodule to make it work against PowerShell 7 -- enable/disable thePowerShellCoreETW provider instead ofMicrosoft-Windows-PowerShell, which is the ETW provider for Windows PowerShell.PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerPSDiagnosticsmodule in PowerShell 7 will be updated to work with the "PowerShellCore" ETW provider MicrosoftDocs/PowerShell-Docs#12091