Skip to content

Commit

Permalink
Remove HostingStartup (#6751)
Browse files Browse the repository at this point in the history
  • Loading branch information
clguiman authored May 31, 2024
1 parent 2f5379b commit 3bd2c0f
Show file tree
Hide file tree
Showing 41 changed files with 41 additions and 601 deletions.
2 changes: 0 additions & 2 deletions documentation/api/parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,6 @@ Content-Type: application/x-ndjson
- The target application must use ASP.NET Core.
- The target application cannot have [Hot Reload](https://learn.microsoft.com/visualstudio/debugger/hot-reload) enabled.
- `dotnet-monitor` must be set to `Listen` mode, and the target application must start suspended. See [diagnostic port configuration](../configuration/diagnostic-port-configuration.md) for information on how to do this.
- The target application must have [`ILogger`](https://learn.microsoft.com/dotnet/api/microsoft.extensions.logging.ilogger) available via [ASP.NET Core's dependency injection](https://learn.microsoft.com/aspnet/core/fundamentals/dependency-injection).
- This feature relies on a hosting startup assembly. If the target application [disabled automatic loading](https://learn.microsoft.com/aspnet/core/fundamentals/host/platform-specific-configuration#disable-automatic-loading-of-hosting-startup-assemblies) of these, this feature will not be available.
- This feature relies on a [ICorProfilerCallback](https://docs.microsoft.com/dotnet/framework/unmanaged-api/profiling/icorprofilercallback-interface) implementation. If the target application is already using an `ICorProfiler` that isn't notify-only, this feature will not be available.
- If a target application is using .NET 7 then the `dotnet-monitor` startup hook must be configured. This is automatically done in .NET 8+.

Expand Down
14 changes: 0 additions & 14 deletions dotnet-monitor.sln
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Diagnostics.Monit
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Extensions", "Extensions", "{D3FEE1C0-E1E7-4796-A217-B46E3B6CCCCD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Diagnostics.Monitoring.HostingStartup", "src\Microsoft.Diagnostics.Monitoring.HostingStartup\Microsoft.Diagnostics.Monitoring.HostingStartup.csproj", "{86BDA5CD-6A18-4EC2-9F13-F1A2723DD864}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Diagnostics.Monitoring.HostingStartup.UnitTests", "src\Tests\Microsoft.Diagnostics.Monitoring.HostingStartup.UnitTests\Microsoft.Diagnostics.Monitoring.HostingStartup.UnitTests.csproj", "{B9216DD7-F216-490A-A388-BBE0EC946EF2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -188,14 +184,6 @@ Global
{E7EA323B-0CFE-4D42-9844-4C322A3BC54A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E7EA323B-0CFE-4D42-9844-4C322A3BC54A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E7EA323B-0CFE-4D42-9844-4C322A3BC54A}.Release|Any CPU.Build.0 = Release|Any CPU
{86BDA5CD-6A18-4EC2-9F13-F1A2723DD864}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{86BDA5CD-6A18-4EC2-9F13-F1A2723DD864}.Debug|Any CPU.Build.0 = Debug|Any CPU
{86BDA5CD-6A18-4EC2-9F13-F1A2723DD864}.Release|Any CPU.ActiveCfg = Release|Any CPU
{86BDA5CD-6A18-4EC2-9F13-F1A2723DD864}.Release|Any CPU.Build.0 = Release|Any CPU
{B9216DD7-F216-490A-A388-BBE0EC946EF2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B9216DD7-F216-490A-A388-BBE0EC946EF2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B9216DD7-F216-490A-A388-BBE0EC946EF2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B9216DD7-F216-490A-A388-BBE0EC946EF2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -231,8 +219,6 @@ Global
{72EC615C-E1BE-4D27-A0FC-C0FEE483D3D2} = {19FAB78C-3351-4911-8F0C-8C6056401740}
{E7EA323B-0CFE-4D42-9844-4C322A3BC54A} = {C7568468-1C79-4944-8136-18812A7F9EA7}
{D3FEE1C0-E1E7-4796-A217-B46E3B6CCCCD} = {19FAB78C-3351-4911-8F0C-8C6056401740}
{86BDA5CD-6A18-4EC2-9F13-F1A2723DD864} = {19FAB78C-3351-4911-8F0C-8C6056401740}
{B9216DD7-F216-490A-A388-BBE0EC946EF2} = {C7568468-1C79-4944-8136-18812A7F9EA7}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {46465737-C938-44FC-BE1A-4CE139EBB5E0}
Expand Down
1 change: 0 additions & 1 deletion eng/AfterSolutionBuild.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<Import Project="$(RepoRoot)src\archives\dotnet-monitor-base\ProjectsToPublish.props" />
<Import Project="$(RepoRoot)src\archives\AzureBlobStorage\ProjectsToPublish.props" />
<Import Project="$(RepoRoot)src\archives\S3Storage\ProjectsToPublish.props" />
<Import Project="$(RepoRoot)src\Microsoft.Diagnostics.Monitoring.HostingStartup\ProjectsToPublish.props" />
<Import Project="$(RepoRoot)src\Microsoft.Diagnostics.Monitoring.StartupHook\ProjectsToPublish.props" />
<Import Project="$(RepoRoot)src\singlefile\dotnet-monitor\ProjectsToPublish.props" />

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using System.Text.Json.Serialization;

#if STARTUPHOOK || HOSTINGSTARTUP
#if STARTUPHOOK
namespace Microsoft.Diagnostics.Monitoring.StartupHook.MonitorMessageDispatcher.Models
#else
namespace Microsoft.Diagnostics.Monitoring.Options
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
using Microsoft.Diagnostics.Monitoring.StartupHook.Monitoring;
using Microsoft.Diagnostics.Monitoring.StartupHook.ParameterCapturing;
using Microsoft.Diagnostics.Tools.Monitor;
using Microsoft.Diagnostics.Tools.Monitor.HostingStartup;
using Microsoft.Diagnostics.Tools.Monitor.Profiler;
using Microsoft.Diagnostics.Tools.Monitor.StartupHook;
using System;
using System.IO;
using MessageDispatcher = Microsoft.Diagnostics.Monitoring.StartupHook.MonitorMessageDispatcher;

namespace Microsoft.Diagnostics.Monitoring.StartupHook
Expand All @@ -18,7 +16,6 @@ internal sealed class DiagnosticsBootstrapper :
IDisposable
{
private readonly CurrentAppDomainExceptionProcessor _exceptionProcessor;
private readonly AspNetHostingStartupLoader? _hostingStartupLoader;
private readonly ParameterCapturingService? _parameterCapturingService;

private long _disposedState;
Expand All @@ -30,13 +27,6 @@ public DiagnosticsBootstrapper()

using IDisposable _ = MonitorExecutionContextTracker.MonitorScope();

string? hostingStartupPath = Environment.GetEnvironmentVariable(StartupHookIdentifiers.EnvironmentVariables.HostingStartupPath);
// TODO: Log if specified hosting startup assembly doesn't exist
if (File.Exists(hostingStartupPath))
{
_hostingStartupLoader = new AspNetHostingStartupLoader(hostingStartupPath);
}

try
{
// Check that the profiler is loaded before establishing the dispatcher, which has a dependency on the existence of the profiler
Expand Down Expand Up @@ -68,7 +58,6 @@ public void Dispose()
_exceptionProcessor.Dispose();
_parameterCapturingService?.Stop();
_parameterCapturingService?.Dispose();
_hostingStartupLoader?.Dispose();
SharedInternals.MessageDispatcher?.Dispose();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
<Compile Include="..\Microsoft.Diagnostics.Monitoring.WebApi\Stacks\NameIdentificationEvents.cs" Link="Exceptions\Eventing\NameIdentificationEvents.cs" />
<Compile Include="..\Tools\dotnet-monitor\DisposableHelper.cs" Link="DisposableHelper.cs" />
<Compile Include="..\Tools\dotnet-monitor\Exceptions\ExceptionEvents.cs" Link="Exceptions\Eventing\ExceptionEvents.cs" />
<Compile Include="..\Tools\dotnet-monitor\StartupHook\StartupHookIdentifiers.cs" Link="StartupHookIdentifiers.cs" />
<Compile Include="..\Tools\dotnet-monitor\ToolIdentifiers.cs" Link="ToolIdentifiers.cs" />
<Compile Include="..\Tools\dotnet-monitor\InProcessFeatures\InProcessFeaturesIdentifiers.cs" Link="InProcessFeaturesIdentifiers.cs" />
<Compile Include="..\Tools\dotnet-monitor\ParameterCapturing\ParameterCapturingEvents.cs" Link="ParameterCapturing\Eventing\ParameterCapturingEvents.cs" />
Expand All @@ -27,9 +26,7 @@
</ItemGroup>

<ItemGroup>
<InternalsVisibleTo Include="Microsoft.Diagnostics.Monitoring.HostingStartup.UnitTests" />
<InternalsVisibleTo Include="Microsoft.Diagnostics.Monitoring.StartupHook.UnitTests" />
<InternalsVisibleTo Include="Microsoft.Diagnostics.Monitoring.HostingStartup" />
<InternalsVisibleTo Include="Microsoft.Diagnostics.Monitoring.UnitTestApp" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ public interface IInProcessFeatures

bool IsStartupHookRequired { get; }

bool IsHostingStartupRequired { get; }

bool IsLibrarySharingRequired { get; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@
using System.Collections.Generic;
using System.Text;

#if HOSTINGSTARTUP
namespace Microsoft.Diagnostics.Monitoring.HostingStartup
#else
namespace Microsoft.Diagnostics.Monitoring.WebApi
#endif
{
// Logger implementations have different ways of serializing log scopes. This class helps those loggers
// serialize the scope information in the best way possible for each of the implementations.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,17 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Generic;

#if HOSTINGSTARTUP
namespace Microsoft.Diagnostics.Monitoring.HostingStartup
#else
using System.Globalization;

namespace Microsoft.Diagnostics.Monitoring.WebApi
#endif
{
internal static class KeyValueLogScopeExtensions
{
public static void Add(this List<KeyValuePair<string, object>> values, string key, object value)
{
values.Add(new KeyValuePair<string, object>(key, value));
}
#if !HOSTINGSTARTUP

public static void AddArtifactType(this KeyValueLogScope scope, string artifactType)
{
scope.Values.Add("ArtifactType", artifactType);
Expand All @@ -32,6 +27,5 @@ public static void AddArtifactEndpointInfo(this KeyValueLogScope scope, IEndpoin
ArtifactMetadataNames.ArtifactSource.RuntimeInstanceCookie,
endpointInfo.RuntimeInstanceCookie.ToString("N"));
}
#endif
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;

#if STARTUPHOOK || HOSTINGSTARTUP
#if STARTUPHOOK
namespace Microsoft.Diagnostics.Monitoring.StartupHook.MonitorMessageDispatcher.Models
#else
namespace Microsoft.Diagnostics.Monitoring.WebApi.Models
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System;
using System.ComponentModel.DataAnnotations;

#if STARTUPHOOK || HOSTINGSTARTUP
#if STARTUPHOOK
namespace Microsoft.Diagnostics.Monitoring.StartupHook.MonitorMessageDispatcher.Models
#else
using Microsoft.Diagnostics.Monitoring.Options;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using System.Text.Json;


#if STARTUPHOOK || HOSTINGSTARTUP
#if STARTUPHOOK
namespace Microsoft.Diagnostics.Monitoring.StartupHook.Monitoring
#else
namespace Microsoft.Diagnostics.Monitoring
Expand All @@ -29,9 +29,6 @@ public enum ProfilerCommand : ushort
Callstack
};

/// <summary>
/// Shared between the StartupHook and HostingStartup assembly.
/// </summary>
public enum StartupHookCommand : ushort
{
StartCapturingParameters,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
<InternalsVisibleTo Include="Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests" />
<InternalsVisibleTo Include="Microsoft.Diagnostics.Monitoring.Tool.UnitTests" />
<InternalsVisibleTo Include="Microsoft.Diagnostics.Monitoring.AzureBlobStorageTests.UnitTests" />
<InternalsVisibleTo Include="Microsoft.Diagnostics.Monitoring.HostingStartup.UnitTests" />
<InternalsVisibleTo Include="Microsoft.Diagnostics.Monitoring.UnitTestApp" />
</ItemGroup>

Expand Down
Loading

0 comments on commit 3bd2c0f

Please sign in to comment.