diff --git a/.github/workflows/add-markdown-feedback.yml b/.github/workflows/add-markdown-feedback.yml index d533cd593ae..67dffbc2b2f 100644 --- a/.github/workflows/add-markdown-feedback.yml +++ b/.github/workflows/add-markdown-feedback.yml @@ -47,7 +47,7 @@ jobs: git diff > ./pr/linter.diff - name: Upload artifacts - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 + uses: actions/upload-artifact@1746f4ab65b179e0ea60a494b83293b640dd5bba with: name: pr-linter path: pr/ diff --git a/.github/workflows/lint-csharp.yml b/.github/workflows/lint-csharp.yml index 3fd19cffec7..48a0055f243 100644 --- a/.github/workflows/lint-csharp.yml +++ b/.github/workflows/lint-csharp.yml @@ -48,7 +48,7 @@ jobs: git diff > ./pr/linter.diff - name: Upload artifacts - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 + uses: actions/upload-artifact@1746f4ab65b179e0ea60a494b83293b640dd5bba with: name: pr-linter path: pr/ diff --git a/.github/workflows/scan-for-to-do-comments.yml b/.github/workflows/scan-for-to-do-comments.yml index 6aa51353744..b1bf07d7f04 100644 --- a/.github/workflows/scan-for-to-do-comments.yml +++ b/.github/workflows/scan-for-to-do-comments.yml @@ -27,7 +27,7 @@ jobs: COMMENT_AUTHOR: ${{ github.event.comment.user.login }} - name: Upload artifacts - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 + uses: actions/upload-artifact@1746f4ab65b179e0ea60a494b83293b640dd5bba with: name: issue-todo path: issue/ diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b169aed0dfe..51d3c5716ed 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -4,13 +4,13 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore 8e941eb42f819adb116b881195158b3887a70a1c - + https://github.com/dotnet/diagnostics - 1f6a0ea3f4d8ced5dc5d640672d3c9b8f373d6fc + c206de0ffb36baa05722c3f43f40c9b4eeb1e5aa - + https://github.com/dotnet/diagnostics - 1f6a0ea3f4d8ced5dc5d640672d3c9b8f373d6fc + c206de0ffb36baa05722c3f43f40c9b4eeb1e5aa https://github.com/dotnet/command-line-api @@ -46,9 +46,9 @@ https://github.com/dotnet/arcade 188340e12c0a372b1681ad6a5e72c608021efdba - - https://github.com/dotnet/symstore - 550601c12a227c87ded32316345934101a8a2422 + + https://github.com/dotnet/diagnostics + c206de0ffb36baa05722c3f43f40c9b4eeb1e5aa https://dev.azure.com/dnceng/internal/_git/dotnet-runtime diff --git a/eng/Versions.props b/eng/Versions.props index 004745a6507..aa42eca9447 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -57,8 +57,8 @@ 2.0.0-beta4.24209.3 - 8.0.0-preview.24212.2 - 8.0.0-preview.24212.2 + 8.0.0-preview.24219.1 + 8.0.0-preview.24219.1 8.0.103-servicing.24114.15 @@ -67,7 +67,7 @@ 8.0.1 8.0.1-servicing.23580.1 - 1.0.517501 + 8.0.0-preview.24219.1 $(MicrosoftNETCoreApp31Version) diff --git a/eng/dependabot/independent/Versions.props b/eng/dependabot/independent/Versions.props index 5c7f41b4332..8c880c126a4 100644 --- a/eng/dependabot/independent/Versions.props +++ b/eng/dependabot/independent/Versions.props @@ -2,10 +2,10 @@ - 1.11.0 + 1.11.1 12.19.1 12.17.1 - 2.17.4 + 2.17.5 1.6.13 4.3.2 5.0.0 diff --git a/eng/pipelines/jobs/test-binaries.yml b/eng/pipelines/jobs/test-binaries.yml index 92602d5f3e2..2e1a251315b 100644 --- a/eng/pipelines/jobs/test-binaries.yml +++ b/eng/pipelines/jobs/test-binaries.yml @@ -81,27 +81,52 @@ jobs: - ${{ if ne(parameters.osGroup, 'Linux_Musl')}}: # Linux builds (of all variants) run in Mariner containers and do not include pwsh by default - ${{ if eq(parameters.osGroup, 'Linux') }}: - - script: sudo -n tdnf install -y --refresh powershell + - script: | + $(Build.SourcesDirectory)/restore.sh + $(Build.SourcesDirectory)/.dotnet/dotnet tool install --global PowerShell + echo "##vso[task.prependpath]/home/cloudtest_azpcontainer/.dotnet/tools" displayName: Install pwsh - # Calculate the fully qualified Nodejs version first so that any new releases will result in a new cache key - - pwsh: eng/helix/GetNodejsVersion.ps1 - -MajorVersion $(NodeMajorVersion) - -TaskVariableName 'FqNodejsVersion' - displayName: Calculate Node.js version - - - task: Cache@2 - displayName: Node.js Cache - inputs: - # Wrap FqNodejsVersion in quotes to prevent it being interpreted as a file - key: 'nodejs | ${{ parameters.osGroup }} | ${{ parameters.architecture }} | "$(FqNodejsVersion)"' - path: $(HelixNodejsPayloadPath) - - - pwsh: eng/helix/InstallNodejs.ps1 - -Version $(FqNodejsVersion) - -Architecture ${{ parameters.architecture }} - -DestinationFolder "$(HelixNodejsPayloadPath)" - displayName: Hydrate Node.js Installation + # Calculate the fully qualified Nodejs version first so that any new releases will result in a new cache key + - script: | + pwsh ../eng/helix/GetNodejsVersion.ps1 -MajorVersion $(NodeMajorVersion) -TaskVariableName 'FqNodejsVersion' + displayName: Calculate Node.js version Linux + workingDirectory: "$(Build.SourcesDirectory)/.dotnet" + env: + DOTNET_ROOT: "$(Build.SourcesDirectory)/.dotnet" + + - task: Cache@2 + displayName: Node.js Cache Linux + inputs: + # Wrap FqNodejsVersion in quotes to prevent it being interpreted as a file + key: 'nodejs | ${{ parameters.osGroup }} | ${{ parameters.architecture }} | "$(FqNodejsVersion)"' + path: $(HelixNodejsPayloadPath) + + - script: | + pwsh ../eng/helix/InstallNodejs.ps1 -Version $(FqNodejsVersion) -Architecture ${{ parameters.architecture }} -DestinationFolder "$(HelixNodejsPayloadPath)" + displayName: Hydrate Node.js Installation Linux + workingDirectory: "$(Build.SourcesDirectory)/.dotnet" + env: + DOTNET_ROOT: "$(Build.SourcesDirectory)/.dotnet" + + - ${{ else }}: + - pwsh: eng/helix/GetNodejsVersion.ps1 + -MajorVersion $(NodeMajorVersion) + -TaskVariableName 'FqNodejsVersion' + displayName: Calculate Node.js version Non-Linux + + - task: Cache@2 + displayName: Node.js Cache Non-Linux + inputs: + # Wrap FqNodejsVersion in quotes to prevent it being interpreted as a file + key: 'nodejs | ${{ parameters.osGroup }} | ${{ parameters.architecture }} | "$(FqNodejsVersion)"' + path: $(HelixNodejsPayloadPath) + + - pwsh: eng/helix/InstallNodejs.ps1 + -Version $(FqNodejsVersion) + -Architecture ${{ parameters.architecture }} + -DestinationFolder "$(HelixNodejsPayloadPath)" + displayName: Hydrate Node.js Installation Non-Linux - ${{ else }}: - ${{ if ne(parameters.osGroup, 'Windows') }}: diff --git a/src/Microsoft.Diagnostics.Monitoring.HostingStartup/ParameterCapturing/ParameterCapturingService.cs b/src/Microsoft.Diagnostics.Monitoring.HostingStartup/ParameterCapturing/ParameterCapturingService.cs index 6550141d837..0599943c75c 100644 --- a/src/Microsoft.Diagnostics.Monitoring.HostingStartup/ParameterCapturing/ParameterCapturingService.cs +++ b/src/Microsoft.Diagnostics.Monitoring.HostingStartup/ParameterCapturing/ParameterCapturingService.cs @@ -5,6 +5,7 @@ using Microsoft.Diagnostics.Monitoring.HostingStartup.ParameterCapturing.FunctionProbes; using Microsoft.Diagnostics.Monitoring.HostingStartup.ParameterCapturing.Pipeline; using Microsoft.Diagnostics.Monitoring.StartupHook; +using Microsoft.Diagnostics.Monitoring.StartupHook.Monitoring; using Microsoft.Diagnostics.Tools.Monitor.ParameterCapturing; using Microsoft.Diagnostics.Tools.Monitor.Profiler; using Microsoft.Diagnostics.Tools.Monitor.StartupHook; diff --git a/src/Microsoft.Diagnostics.Monitoring.Options/StorageOptions.cs b/src/Microsoft.Diagnostics.Monitoring.Options/StorageOptions.cs index 703aef9f6bb..aaf9240cbbc 100644 --- a/src/Microsoft.Diagnostics.Monitoring.Options/StorageOptions.cs +++ b/src/Microsoft.Diagnostics.Monitoring.Options/StorageOptions.cs @@ -6,7 +6,7 @@ namespace Microsoft.Diagnostics.Monitoring.WebApi { - internal class StorageOptions + public class StorageOptions { [Display( ResourceType = typeof(OptionsDisplayStrings), diff --git a/src/Microsoft.Diagnostics.Monitoring.StartupHook/DiagnosticsBootstrapper.cs b/src/Microsoft.Diagnostics.Monitoring.StartupHook/DiagnosticsBootstrapper.cs index 515f0c18aad..414c677e5b3 100644 --- a/src/Microsoft.Diagnostics.Monitoring.StartupHook/DiagnosticsBootstrapper.cs +++ b/src/Microsoft.Diagnostics.Monitoring.StartupHook/DiagnosticsBootstrapper.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using Microsoft.Diagnostics.Monitoring.StartupHook.Exceptions; +using Microsoft.Diagnostics.Monitoring.StartupHook.Monitoring; using Microsoft.Diagnostics.Tools.Monitor; using Microsoft.Diagnostics.Tools.Monitor.HostingStartup; using Microsoft.Diagnostics.Tools.Monitor.Profiler; diff --git a/src/Microsoft.Diagnostics.Monitoring.StartupHook/MonitorMessageDispatcher/MonitorMessageDispatcher.cs b/src/Microsoft.Diagnostics.Monitoring.StartupHook/MonitorMessageDispatcher/MonitorMessageDispatcher.cs index d3170aa1a8e..6d234d8258f 100644 --- a/src/Microsoft.Diagnostics.Monitoring.StartupHook/MonitorMessageDispatcher/MonitorMessageDispatcher.cs +++ b/src/Microsoft.Diagnostics.Monitoring.StartupHook/MonitorMessageDispatcher/MonitorMessageDispatcher.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. +using Microsoft.Diagnostics.Monitoring.StartupHook.Monitoring; using System; using System.Collections.Generic; using System.IO; diff --git a/src/Microsoft.Diagnostics.Monitoring.StartupHook/MonitorMessageDispatcher/ProfilerMessageSource.cs b/src/Microsoft.Diagnostics.Monitoring.StartupHook/MonitorMessageDispatcher/ProfilerMessageSource.cs index 511d38f2d83..f81cf3135ca 100644 --- a/src/Microsoft.Diagnostics.Monitoring.StartupHook/MonitorMessageDispatcher/ProfilerMessageSource.cs +++ b/src/Microsoft.Diagnostics.Monitoring.StartupHook/MonitorMessageDispatcher/ProfilerMessageSource.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. +using Microsoft.Diagnostics.Monitoring.StartupHook.Monitoring; using Microsoft.Diagnostics.Tools.Monitor.Profiler; using System; using System.Runtime.InteropServices; diff --git a/src/Microsoft.Diagnostics.Monitoring.WebApi/Auth/AuthConstants.cs b/src/Microsoft.Diagnostics.Monitoring.WebApi/Auth/AuthConstants.cs index d5ad49638a5..ce63a2fdcb0 100644 --- a/src/Microsoft.Diagnostics.Monitoring.WebApi/Auth/AuthConstants.cs +++ b/src/Microsoft.Diagnostics.Monitoring.WebApi/Auth/AuthConstants.cs @@ -4,7 +4,7 @@ namespace Microsoft.Diagnostics.Monitoring.WebApi { - internal static class AuthConstants + public static class AuthConstants { public const string PolicyName = "AuthorizedUserPolicy"; public const string NegotiateSchema = "Negotiate"; diff --git a/src/Microsoft.Diagnostics.Monitoring.WebApi/ContentTypes.cs b/src/Microsoft.Diagnostics.Monitoring.WebApi/ContentTypes.cs index 2cc2129ebc9..063be35f7ed 100644 --- a/src/Microsoft.Diagnostics.Monitoring.WebApi/ContentTypes.cs +++ b/src/Microsoft.Diagnostics.Monitoring.WebApi/ContentTypes.cs @@ -3,7 +3,7 @@ namespace Microsoft.Diagnostics.Monitoring.WebApi { - internal static class ContentTypes + public static class ContentTypes { public const string ApplicationJson = "application/json"; public const string ApplicationJsonSequence = "application/json-seq"; diff --git a/src/Microsoft.Diagnostics.Monitoring.WebApi/Controllers/DiagnosticsControllerBase.cs b/src/Microsoft.Diagnostics.Monitoring.WebApi/Controllers/DiagnosticsControllerBase.cs index e093544ac49..4934f5b5751 100644 --- a/src/Microsoft.Diagnostics.Monitoring.WebApi/Controllers/DiagnosticsControllerBase.cs +++ b/src/Microsoft.Diagnostics.Monitoring.WebApi/Controllers/DiagnosticsControllerBase.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using System; using System.Threading.Tasks; @@ -10,6 +11,10 @@ namespace Microsoft.Diagnostics.Monitoring.WebApi.Controllers { public abstract class DiagnosticsControllerBase : ControllerBase { + protected DiagnosticsControllerBase(IServiceProvider serviceProvider, ILogger logger) : + this(serviceProvider.GetRequiredService(), serviceProvider.GetRequiredService(), logger) + { } + private protected DiagnosticsControllerBase(IDiagnosticServices diagnosticServices, EgressOperationStore operationStore, ILogger logger) { DiagnosticServices = diagnosticServices ?? throw new ArgumentNullException(nameof(diagnosticServices)); @@ -17,7 +22,7 @@ private protected DiagnosticsControllerBase(IDiagnosticServices diagnosticServic Logger = logger ?? throw new ArgumentNullException(nameof(logger)); } - private protected Task InvokeForProcess(Func func, ProcessKey? processKey, string artifactType = null) + protected Task InvokeForProcess(Func func, ProcessKey? processKey, string artifactType = null) { Func> asyncFunc = processInfo => Task.FromResult(func(processInfo)); @@ -25,19 +30,19 @@ private protected Task InvokeForProcess(Func InvokeForProcess(Func> func, ProcessKey? processKey, string artifactType) + protected async Task InvokeForProcess(Func> func, ProcessKey? processKey, string artifactType) { ActionResult result = await InvokeForProcess(async processInfo => await func(processInfo), processKey, artifactType); return result.Result; } - private protected Task> InvokeForProcess(Func> func, ProcessKey? processKey, string artifactType = null) + protected Task> InvokeForProcess(Func> func, ProcessKey? processKey, string artifactType = null) { return InvokeForProcess(processInfo => Task.FromResult(func(processInfo)), processKey, artifactType); } - private protected async Task> InvokeForProcess(Func>> func, ProcessKey? processKey, string artifactType = null) + protected async Task> InvokeForProcess(Func>> func, ProcessKey? processKey, string artifactType = null) { IDisposable artifactTypeRegistration = null; if (!string.IsNullOrEmpty(artifactType)) @@ -68,7 +73,7 @@ private protected async Task> InvokeForProcess(Func Result( + protected async Task Result( string artifactType, string providerName, IArtifactOperation operation, diff --git a/src/Microsoft.Diagnostics.Monitoring.WebApi/Controllers/ExceptionsController.cs b/src/Microsoft.Diagnostics.Monitoring.WebApi/Controllers/ExceptionsController.cs index 30a644ba45f..3af23c32b16 100644 --- a/src/Microsoft.Diagnostics.Monitoring.WebApi/Controllers/ExceptionsController.cs +++ b/src/Microsoft.Diagnostics.Monitoring.WebApi/Controllers/ExceptionsController.cs @@ -31,7 +31,7 @@ public sealed class ExceptionsController : public ExceptionsController( IServiceProvider serviceProvider, ILogger logger) - : base(serviceProvider.GetRequiredService(), serviceProvider.GetRequiredService(), logger) + : base(serviceProvider, logger) { _options = serviceProvider.GetRequiredService>(); } diff --git a/src/Microsoft.Diagnostics.Monitoring.WebApi/EgressValidationAttribute.cs b/src/Microsoft.Diagnostics.Monitoring.WebApi/EgressValidationAttribute.cs index 9dc8f3369cf..0a760e418f6 100644 --- a/src/Microsoft.Diagnostics.Monitoring.WebApi/EgressValidationAttribute.cs +++ b/src/Microsoft.Diagnostics.Monitoring.WebApi/EgressValidationAttribute.cs @@ -12,7 +12,7 @@ namespace Microsoft.Diagnostics.Monitoring.WebApi { [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)] - internal sealed class EgressValidationAttribute : ActionFilterAttribute, IFilterFactory + public sealed class EgressValidationAttribute : ActionFilterAttribute, IFilterFactory { public bool IsReusable => true; diff --git a/src/Microsoft.Diagnostics.Monitoring.WebApi/EndpointInfo/IEndpointInfoSource.cs b/src/Microsoft.Diagnostics.Monitoring.WebApi/EndpointInfo/IEndpointInfoSource.cs index 8fce2891ffa..1d17af1f986 100644 --- a/src/Microsoft.Diagnostics.Monitoring.WebApi/EndpointInfo/IEndpointInfoSource.cs +++ b/src/Microsoft.Diagnostics.Monitoring.WebApi/EndpointInfo/IEndpointInfoSource.cs @@ -9,9 +9,9 @@ namespace Microsoft.Diagnostics.Monitoring.WebApi { - internal interface IEndpointInfo + public interface IEndpointInfo { - IpcEndpoint Endpoint { get; } + internal IpcEndpoint Endpoint { get; } int ProcessId { get; } diff --git a/src/Microsoft.Diagnostics.Monitoring.WebApi/HostRestrictionAttribute.cs b/src/Microsoft.Diagnostics.Monitoring.WebApi/HostRestrictionAttribute.cs index 697f2e03420..8894df008c5 100644 --- a/src/Microsoft.Diagnostics.Monitoring.WebApi/HostRestrictionAttribute.cs +++ b/src/Microsoft.Diagnostics.Monitoring.WebApi/HostRestrictionAttribute.cs @@ -13,7 +13,7 @@ namespace Microsoft.Diagnostics.Monitoring.WebApi /// To do this, we determine what port the request is on, and disallow other actions on the prometheus port. /// [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)] - internal sealed class HostRestrictionAttribute : Attribute, IActionConstraintFactory + public sealed class HostRestrictionAttribute : Attribute, IActionConstraintFactory { private sealed class HostConstraint : IActionConstraint { diff --git a/src/Microsoft.Diagnostics.Monitoring.WebApi/IArtifactOperation.cs b/src/Microsoft.Diagnostics.Monitoring.WebApi/IArtifactOperation.cs index cbd1ad7ac7c..231a664930d 100644 --- a/src/Microsoft.Diagnostics.Monitoring.WebApi/IArtifactOperation.cs +++ b/src/Microsoft.Diagnostics.Monitoring.WebApi/IArtifactOperation.cs @@ -11,7 +11,7 @@ namespace Microsoft.Diagnostics.Monitoring.WebApi /// Represents an operation that can produce a diagnostic /// artifact to the provided output stream. /// - internal interface IArtifactOperation : IStartable + public interface IArtifactOperation : IStartable { /// /// Produces a diagnostic artifact to the output stream. diff --git a/src/Microsoft.Diagnostics.Monitoring.WebApi/IDiagnosticServices.cs b/src/Microsoft.Diagnostics.Monitoring.WebApi/IDiagnosticServices.cs index 38b80f7c608..5f4d732395f 100644 --- a/src/Microsoft.Diagnostics.Monitoring.WebApi/IDiagnosticServices.cs +++ b/src/Microsoft.Diagnostics.Monitoring.WebApi/IDiagnosticServices.cs @@ -29,7 +29,7 @@ internal interface IDiagnosticServices Task GetProcessAsync(ProcessKey? processKey, CancellationToken token); } - internal interface IProcessInfo + public interface IProcessInfo { IEndpointInfo EndpointInfo { get; } diff --git a/src/Microsoft.Diagnostics.Monitoring.WebApi/IStartable.cs b/src/Microsoft.Diagnostics.Monitoring.WebApi/IStartable.cs index 11ea2de8d31..dcfa061a50b 100644 --- a/src/Microsoft.Diagnostics.Monitoring.WebApi/IStartable.cs +++ b/src/Microsoft.Diagnostics.Monitoring.WebApi/IStartable.cs @@ -5,7 +5,7 @@ namespace Microsoft.Diagnostics.Monitoring.WebApi { - internal interface IStartable + public interface IStartable { Task Started { get; } } diff --git a/src/Microsoft.Diagnostics.Monitoring.WebApi/KeyValueLogScope.cs b/src/Microsoft.Diagnostics.Monitoring.WebApi/KeyValueLogScope.cs index 14d214164cf..76f62de6635 100644 --- a/src/Microsoft.Diagnostics.Monitoring.WebApi/KeyValueLogScope.cs +++ b/src/Microsoft.Diagnostics.Monitoring.WebApi/KeyValueLogScope.cs @@ -21,7 +21,7 @@ namespace Microsoft.Diagnostics.Monitoring.WebApi // - Event Log Logger: checks for IEnumerable> and formats each value // in the enumeration; otherwise falls back to ToString. // - Structured Logger: expects a IReadOnlyList> and formats each value in the enumeration. - internal class KeyValueLogScope : IReadOnlyList> + public class KeyValueLogScope : IReadOnlyList> { public List> Values = new(); diff --git a/src/Microsoft.Diagnostics.Monitoring.WebApi/ProcessKey.cs b/src/Microsoft.Diagnostics.Monitoring.WebApi/ProcessKey.cs index 9390a62f73f..91456ca38d3 100644 --- a/src/Microsoft.Diagnostics.Monitoring.WebApi/ProcessKey.cs +++ b/src/Microsoft.Diagnostics.Monitoring.WebApi/ProcessKey.cs @@ -8,41 +8,41 @@ namespace Microsoft.Diagnostics.Monitoring.WebApi { [TypeConverter(typeof(ProcessKeyTypeConverter))] - internal struct ProcessKey + public struct ProcessKey { - internal ProcessKey(int processId) + public ProcessKey(int processId) { ProcessId = processId; ProcessName = null; RuntimeInstanceCookie = null; } - internal ProcessKey(Guid runtimeInstanceCookie) + public ProcessKey(Guid runtimeInstanceCookie) { ProcessId = null; ProcessName = null; RuntimeInstanceCookie = runtimeInstanceCookie; } - internal ProcessKey(string processName) + public ProcessKey(string processName) { ProcessId = null; ProcessName = processName; RuntimeInstanceCookie = null; } - internal ProcessKey(int? processId = null, Guid? runtimeInstanceCookie = null, string processName = null) + public ProcessKey(int? processId = null, Guid? runtimeInstanceCookie = null, string processName = null) { ProcessId = processId; ProcessName = processName; RuntimeInstanceCookie = runtimeInstanceCookie; } - internal int? ProcessId { get; } + public int? ProcessId { get; } - internal string ProcessName { get; } + public string ProcessName { get; } - internal Guid? RuntimeInstanceCookie { get; } + public Guid? RuntimeInstanceCookie { get; } } internal class ProcessKeyTypeConverter : TypeConverter diff --git a/src/Microsoft.Diagnostics.Monitoring.WebApi/ProfilerChannel.cs b/src/Microsoft.Diagnostics.Monitoring.WebApi/ProfilerChannel.cs index ae72b944249..ce07974f9e1 100644 --- a/src/Microsoft.Diagnostics.Monitoring.WebApi/ProfilerChannel.cs +++ b/src/Microsoft.Diagnostics.Monitoring.WebApi/ProfilerChannel.cs @@ -4,6 +4,7 @@ using Microsoft.Extensions.Options; using System; using System.Diagnostics; +using System.Globalization; using System.IO; using System.Net.Sockets; using System.Runtime.InteropServices; @@ -15,7 +16,7 @@ namespace Microsoft.Diagnostics.Monitoring.WebApi /// /// Communicates with the profiler, using a Unix Domain Socket. /// - internal sealed class ProfilerChannel + public sealed class ProfilerChannel { private const int MaxPayloadSize = 4 * 1024 * 1024; // 4 MiB @@ -30,7 +31,13 @@ public async Task SendMessage(IEndpointInfo endpointInfo, IProfilerMessage messa { if (message.Payload.Length > MaxPayloadSize) { - throw new ArgumentException(nameof(message)); + throw new ArgumentException( + string.Format( + CultureInfo.InvariantCulture, + Strings.ErrorMessage_ProfilerPayloadTooLarge, + message.Payload.Length, + MaxPayloadSize), + nameof(message)); } string channelPath = ComputeChannelPath(endpointInfo); diff --git a/src/Microsoft.Diagnostics.Monitoring.WebApi/ProfilerMessage.cs b/src/Microsoft.Diagnostics.Monitoring.WebApi/ProfilerMessage.cs index 29fcc0b3c32..6255ace92af 100644 --- a/src/Microsoft.Diagnostics.Monitoring.WebApi/ProfilerMessage.cs +++ b/src/Microsoft.Diagnostics.Monitoring.WebApi/ProfilerMessage.cs @@ -5,21 +5,26 @@ using System.Text; using System.Text.Json; + +#if STARTUPHOOK || HOSTINGSTARTUP +namespace Microsoft.Diagnostics.Monitoring.StartupHook.Monitoring +#else namespace Microsoft.Diagnostics.Monitoring +#endif { - internal enum CommandSet : ushort + public enum CommandSet : ushort { ServerResponse, Profiler, StartupHook } - internal enum ServerResponseCommand : ushort + public enum ServerResponseCommand : ushort { Status }; - internal enum ProfilerCommand : ushort + public enum ProfilerCommand : ushort { Callstack }; @@ -27,20 +32,20 @@ internal enum ProfilerCommand : ushort /// /// Shared between the StartupHook and HostingStartup assembly. /// - internal enum StartupHookCommand : ushort + public enum StartupHookCommand : ushort { StartCapturingParameters, StopCapturingParameters }; - internal interface IProfilerMessage + public interface IProfilerMessage { public ushort CommandSet { get; } public ushort Command { get; } public byte[] Payload { get; } } - internal struct JsonProfilerMessage : IProfilerMessage + public struct JsonProfilerMessage : IProfilerMessage { public ushort CommandSet { get; } public ushort Command { get; } @@ -63,7 +68,7 @@ private static byte[] SerializePayload(object payloadObject) } } - internal struct CommandOnlyProfilerMessage : IProfilerMessage + public struct CommandOnlyProfilerMessage : IProfilerMessage { public ushort CommandSet { get; } public ushort Command { get; } diff --git a/src/Microsoft.Diagnostics.Monitoring.WebApi/StreamDefaults.cs b/src/Microsoft.Diagnostics.Monitoring.WebApi/StreamDefaults.cs index 27bdd00f77d..3b28b2a54c7 100644 --- a/src/Microsoft.Diagnostics.Monitoring.WebApi/StreamDefaults.cs +++ b/src/Microsoft.Diagnostics.Monitoring.WebApi/StreamDefaults.cs @@ -3,7 +3,7 @@ namespace Microsoft.Diagnostics.Monitoring.WebApi { - internal static class StreamDefaults + public static class StreamDefaults { // Matches FileStream.DefaultBufferSize public const int BufferSize = 4096; diff --git a/src/Microsoft.Diagnostics.Monitoring.WebApi/Strings.Designer.cs b/src/Microsoft.Diagnostics.Monitoring.WebApi/Strings.Designer.cs index 04bc00e1768..a9b823d6b86 100644 --- a/src/Microsoft.Diagnostics.Monitoring.WebApi/Strings.Designer.cs +++ b/src/Microsoft.Diagnostics.Monitoring.WebApi/Strings.Designer.cs @@ -195,6 +195,15 @@ internal static string ErrorMessage_ProcessEnumerationFailed { } } + /// + /// Looks up a localized string similar to The message payload is {1} bytes which exceeds the maximum size of {0} bytes. . + /// + internal static string ErrorMessage_ProfilerPayloadTooLarge { + get { + return ResourceManager.GetString("ErrorMessage_ProfilerPayloadTooLarge", resourceCulture); + } + } + /// /// Looks up a localized string similar to Resource {0} cannot be found. /// diff --git a/src/Microsoft.Diagnostics.Monitoring.WebApi/Strings.resx b/src/Microsoft.Diagnostics.Monitoring.WebApi/Strings.resx index 3c0ed672c57..d8f2ca1fc88 100644 --- a/src/Microsoft.Diagnostics.Monitoring.WebApi/Strings.resx +++ b/src/Microsoft.Diagnostics.Monitoring.WebApi/Strings.resx @@ -170,6 +170,9 @@ Unable to enumerate processes. Gets a string similar to "Unable to enumerate processes.". + + The message payload is {1} bytes which exceeds the maximum size of {0} bytes. + Resource {0} cannot be found Gets the format string for when an embedded resource is requested that doesn't exist diff --git a/src/Microsoft.Diagnostics.Monitoring.WebApi/Utilities/Utilities.cs b/src/Microsoft.Diagnostics.Monitoring.WebApi/Utilities/Utilities.cs index ab09e8302cf..7d04ecbb8b3 100644 --- a/src/Microsoft.Diagnostics.Monitoring.WebApi/Utilities/Utilities.cs +++ b/src/Microsoft.Diagnostics.Monitoring.WebApi/Utilities/Utilities.cs @@ -8,7 +8,7 @@ namespace Microsoft.Diagnostics.Monitoring.WebApi { - internal static class Utilities + public static class Utilities { public const string ArtifactType_Dump = "dump"; public const string ArtifactType_GCDump = "gcdump"; diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.AzureBlobStorageTests.UnitTests/Microsoft.Diagnostics.Monitoring.AzureBlobStorageTests.UnitTests.csproj b/src/Tests/Microsoft.Diagnostics.Monitoring.AzureBlobStorageTests.UnitTests/Microsoft.Diagnostics.Monitoring.AzureBlobStorageTests.UnitTests.csproj index 8235e96a9b9..78a2eca5332 100644 --- a/src/Tests/Microsoft.Diagnostics.Monitoring.AzureBlobStorageTests.UnitTests/Microsoft.Diagnostics.Monitoring.AzureBlobStorageTests.UnitTests.csproj +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.AzureBlobStorageTests.UnitTests/Microsoft.Diagnostics.Monitoring.AzureBlobStorageTests.UnitTests.csproj @@ -5,10 +5,6 @@ true - - - - diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.S3StorageTests.UnitTests/Microsoft.Diagnostics.Monitoring.S3StorageTests.UnitTests.csproj b/src/Tests/Microsoft.Diagnostics.Monitoring.S3StorageTests.UnitTests/Microsoft.Diagnostics.Monitoring.S3StorageTests.UnitTests.csproj index b96f633d4b9..506bfcab56e 100644 --- a/src/Tests/Microsoft.Diagnostics.Monitoring.S3StorageTests.UnitTests/Microsoft.Diagnostics.Monitoring.S3StorageTests.UnitTests.csproj +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.S3StorageTests.UnitTests/Microsoft.Diagnostics.Monitoring.S3StorageTests.UnitTests.csproj @@ -4,10 +4,6 @@ $(ToolTargetFrameworks) - - - - diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/GenerateKeyTests.cs b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/GenerateKeyTests.cs index 9b82d5a2839..c6dec5b8fe9 100644 --- a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/GenerateKeyTests.cs +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/GenerateKeyTests.cs @@ -7,6 +7,7 @@ using Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.Runners; using Microsoft.Diagnostics.Monitoring.WebApi; using Microsoft.IdentityModel.Tokens; +using Microsoft.IdentityModel.Validators; using System.IdentityModel.Tokens.Jwt; using System.Security.Claims; using System.Threading; @@ -90,6 +91,9 @@ public async Task GenerateKey(OutputFormat? format) ValidateActor = false, ValidateLifetime = false, }; + // Required for CodeQL. + tokenValidationParams.EnableAadSigningKeyIssuerValidation(); + ClaimsPrincipal claimsPrinciple = tokenHandler.ValidateToken(tokenStr, tokenValidationParams, out SecurityToken validatedToken); Assert.True(claimsPrinciple.HasClaim(ClaimTypes.NameIdentifier, subject)); diff --git a/src/Tools/dotnet-monitor/Auth/ApiKey/JwtBearerOptionsExtensions.cs b/src/Tools/dotnet-monitor/Auth/ApiKey/JwtBearerOptionsExtensions.cs index 3f36cef64f7..2eeea6cd475 100644 --- a/src/Tools/dotnet-monitor/Auth/ApiKey/JwtBearerOptionsExtensions.cs +++ b/src/Tools/dotnet-monitor/Auth/ApiKey/JwtBearerOptionsExtensions.cs @@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.Diagnostics.Monitoring.WebApi; using Microsoft.IdentityModel.Tokens; +using Microsoft.IdentityModel.Validators; namespace Microsoft.Diagnostics.Tools.Monitor.Auth.ApiKey { @@ -31,6 +32,10 @@ public static void ConfigureApiKeyTokenValidation(this JwtBearerOptions options, ValidateActor = false, ValidateLifetime = false, }; + + // Required for CodeQL. + tokenValidationParameters.EnableAadSigningKeyIssuerValidation(); + options.TokenValidationParameters = tokenValidationParameters; } } diff --git a/src/Tools/dotnet-monitor/IDiagnosticLifetimeService.cs b/src/Tools/dotnet-monitor/IDiagnosticLifetimeService.cs index 158d8a7b690..5e4ef419ca7 100644 --- a/src/Tools/dotnet-monitor/IDiagnosticLifetimeService.cs +++ b/src/Tools/dotnet-monitor/IDiagnosticLifetimeService.cs @@ -9,7 +9,7 @@ namespace Microsoft.Diagnostics.Tools.Monitor /// /// Callbacks for the lifetime events related to the diagnostic connection. /// - internal interface IDiagnosticLifetimeService + public interface IDiagnosticLifetimeService { /// /// Invoked just as the target process is discovered and is available for diagnostics. diff --git a/src/Tools/dotnet-monitor/StartupHook/StartupHookApplicator.cs b/src/Tools/dotnet-monitor/StartupHook/StartupHookApplicator.cs index 4336445747b..9cf4dafc944 100644 --- a/src/Tools/dotnet-monitor/StartupHook/StartupHookApplicator.cs +++ b/src/Tools/dotnet-monitor/StartupHook/StartupHookApplicator.cs @@ -14,7 +14,7 @@ namespace Microsoft.Diagnostics.Tools.Monitor.StartupHook { - internal sealed class StartupHookApplicator + public sealed class StartupHookApplicator { private readonly ILogger _logger; private readonly IEndpointInfo _endpointInfo;