forked from DataDog/dd-trace-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Load Datadog.Trace.ClrProfiler.Managed via the AppDomain.AssemblyReso…
…lve event (DataDog#505) Product changes: - In `Datadog.Trace.ClrProfiler.Managed.Loader` add the `AppDomain.AssemblyResolve` event handler to load managed profiler dependencies from disk where the profiler is installed. This would remove the need to install files into the GAC or add the `Datadog.Trace.ClrProfiler.Managed` NuGet package to receive auto-instrumentation. - Stop adding assembly references to the managed profiler code in `ModuleLoadFinished` and instead do that operation in `JITCompilationStarted`. Because of this delayed reference, the runtime will not be able to resolve the assembly reference automatically (perhaps avoiding the SecurityGrant exceptions we have seen in the past!) and will rely on the newly implemented `AppDomain.AssemblyResolve` event to find the managed profiler code. - Build `Datadog.Trace.ClrProfiler.Managed.Loader` for `netcoreapp2.0` and `net45` because reading environment variables (to obtain profiler file path) is only supported on `netstandard1.3` and higher. Build changes: - Combine common settings in `Directory.Build.props` for reproductions, reproduction-dependencies, and samples into `./Test.Common.props` - For Windows-ready xUnit integration tests, add the `RunOnWindows=True` trait - Produce managed profiler assets by running `dotnet publish Datadog.Trace.ClrProfiler.Managed` for each target framework - Stop building `Datadog.Trace.ClrProfiler.Managed.Loader.csproj` inside `Datadog.Trace.proj`'s `BuildCpp` target and instead build it separately whenever we build `Datadog.Trace.ClrProfiler.Native`
- Loading branch information
1 parent
47d87a6
commit 7b96de3
Showing
63 changed files
with
758 additions
and
194 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<OutputType Condition="'$(OutputType)' == ''">Exe</OutputType> | ||
<Platforms>x64;x86</Platforms> | ||
<PlatformTarget>$(Platform)</PlatformTarget> | ||
|
||
<BaseIntermediateOutputPath Condition="'$(ApiVersion)'!=''">obj\$(ApiVersion)\</BaseIntermediateOutputPath> | ||
<BaseOutputPath Condition="'$(ApiVersion)'!=''">bin\$(ApiVersion)\</BaseOutputPath> | ||
|
||
<IsPackable>false</IsPackable> | ||
<GenerateDocumentationFile>false</GenerateDocumentationFile> | ||
<ProfilerOutputDirectory>$(MSBuildThisFileDirectory)\src\Datadog.Trace.ClrProfiler.Native\bin\$(Configuration)\$(Platform)</ProfilerOutputDirectory> | ||
<ManagedProfilerOutputDirectory Condition="'$(ManagedProfilerOutputDirectory)' == ''">$(MSBuildThisFileDirectory)\src\Datadog.Trace.ClrProfiler.Managed\bin\$(Configuration)</ManagedProfilerOutputDirectory> | ||
|
||
<DefineConstants Condition="'$(BuildingInsideVisualStudio)'=='true' or '$(TestAllPackageVersions)'!='true'">$(DefineConstants);DEFAULT_SAMPLES</DefineConstants> | ||
</PropertyGroup> | ||
|
||
<ItemGroup Condition="'$(ExcludeManagedProfiler)' != 'true' and | ||
'$(LoadManagedProfilerFromProfilerDirectory)' != 'true' "> | ||
<ProjectReference Include="$(MSBuildThisFileDirectory)\src\Datadog.Trace.ClrProfiler.Managed\Datadog.Trace.ClrProfiler.Managed.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition="'$(ExcludeNativeProfiler)' != 'true'"> | ||
<None Include="$(ProfilerOutputDirectory)\*.dll;$(ProfilerOutputDirectory)\*.so;$(ProfilerOutputDirectory)\*.pdb" | ||
CopyToOutputDirectory="Always" | ||
CopyToPublishDirectory="Always" | ||
Link="profiler-lib\%(RecursiveDir)\%(Filename)%(Extension)" /> | ||
<Content Include="$(MSBuildThisFileDirectory)\integrations.json" | ||
CopyToOutputDirectory="Always" | ||
CopyToPublishDirectory="Always" | ||
Link="profiler-lib\integrations.json" /> | ||
</ItemGroup> | ||
|
||
<Target Name="AfterBuildCopyManagedProfiler" AfterTargets="AfterBuild" Condition=" '$(LoadManagedProfilerFromProfilerDirectory)' == 'true'"> | ||
<ItemGroup> | ||
<!-- Subfolders of the output directory should each be a target framework --> | ||
<ManagedProfilerFiles Include="$(ManagedProfilerOutputDirectory)\**\*.dll" Exclude="$(ManagedProfilerOutputDirectory)\*\runtimes\**\*.dll" /> | ||
<ManagedProfilerFiles Include="$(ManagedProfilerOutputDirectory)\**\*.pdb" Exclude="$(ManagedProfilerOutputDirectory)\*\runtimes\**\*.pdb" /> | ||
</ItemGroup> | ||
|
||
<!-- Remove the following debugging statements when it works in CI--> | ||
<Message Text="ManagedProfilerOutputDirectory = $(ManagedProfilerOutputDirectory)" Importance="High" /> | ||
<Message Text="ManagedProfilerFiles = @(ManagedProfilerFiles)" Importance="High" /> | ||
|
||
<Copy SourceFiles="@(ManagedProfilerFiles)" DestinationFolder="$(OutputPath)profiler-lib\%(RecursiveDir)" /> | ||
</Target> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
deploy/Datadog.Trace.ClrProfiler.WindowsInstaller/Files.Managed.Net45.wxs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" | ||
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"> | ||
<?include $(sys.CURRENTDIR)\Config.wxi?> | ||
<Fragment> | ||
<ComponentGroup Id="Files.Managed.Net45" Directory="net45"> | ||
<Component Win64="$(var.Win64)"> | ||
<File Id="net45_Datadog.Trace.ClrProfiler.Managed.dll" | ||
Source="$(var.ManagedDllPath)\net45\Datadog.Trace.ClrProfiler.Managed.dll" | ||
KeyPath="yes" Checksum="yes"/> | ||
</Component> | ||
<Component Win64="$(var.Win64)"> | ||
<File Id="net45_Datadog.Trace.dll" | ||
Source="$(var.ManagedDllPath)\net45\Datadog.Trace.dll" | ||
KeyPath="yes" Checksum="yes"/> | ||
</Component> | ||
<Component Win64="$(var.Win64)"> | ||
<File Id="net45_MsgPack.dll" | ||
Source="$(var.ManagedDllPath)\net45\MsgPack.dll" | ||
KeyPath="yes" Checksum="yes"/> | ||
</Component> | ||
<Component Win64="$(var.Win64)"> | ||
<File Id="net45_Newtonsoft.Json.dll" | ||
Source="$(var.ManagedDllPath)\net45\Newtonsoft.Json.dll" | ||
KeyPath="yes" Checksum="yes"/> | ||
</Component> | ||
<Component Win64="$(var.Win64)"> | ||
<File Id="net45_Sigil.dll" | ||
Source="$(var.ManagedDllPath)\net45\Sigil.dll" | ||
KeyPath="yes" Checksum="yes"/> | ||
</Component> | ||
<Component Win64="$(var.Win64)"> | ||
<File Id="net45_System.Runtime.InteropServices.RuntimeInformation.dll" | ||
Source="$(var.ManagedDllPath)\net45\System.Runtime.InteropServices.RuntimeInformation.dll" | ||
KeyPath="yes" Checksum="yes"/> | ||
</Component> | ||
</ComponentGroup> | ||
</Fragment> | ||
</Wix> |
65 changes: 65 additions & 0 deletions
65
deploy/Datadog.Trace.ClrProfiler.WindowsInstaller/Files.Managed.Net461.wxs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" | ||
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"> | ||
<?include $(sys.CURRENTDIR)\Config.wxi?> | ||
<Fragment> | ||
<ComponentGroup Id="Files.Managed.Net461" Directory="net461"> | ||
<Component Win64="$(var.Win64)"> | ||
<File Id="net461_Datadog.Trace.ClrProfiler.Managed.dll" | ||
Source="$(var.ManagedDllPath)\net461\Datadog.Trace.ClrProfiler.Managed.dll" | ||
KeyPath="yes" Checksum="yes"/> | ||
</Component> | ||
<Component Win64="$(var.Win64)"> | ||
<File Id="net461_Datadog.Trace.dll" | ||
Source="$(var.ManagedDllPath)\net461\Datadog.Trace.dll" | ||
KeyPath="yes" Checksum="yes"/> | ||
</Component> | ||
<Component Win64="$(var.Win64)"> | ||
<File Id="net461_MsgPack.dll" | ||
Source="$(var.ManagedDllPath)\net461\MsgPack.dll" | ||
KeyPath="yes" Checksum="yes"/> | ||
</Component> | ||
<Component Win64="$(var.Win64)"> | ||
<File Id="net461_Newtonsoft.Json.dll" | ||
Source="$(var.ManagedDllPath)\net461\Newtonsoft.Json.dll" | ||
KeyPath="yes" Checksum="yes"/> | ||
</Component> | ||
<Component Win64="$(var.Win64)"> | ||
<File Id="net461_Sigil.dll" | ||
Source="$(var.ManagedDllPath)\net461\Sigil.dll" | ||
KeyPath="yes" Checksum="yes"/> | ||
</Component> | ||
<Component Win64="$(var.Win64)"> | ||
<File Id="net461_System.Net.Http.dll" | ||
Source="$(var.ManagedDllPath)\net461\System.Net.Http.dll" | ||
KeyPath="yes" Checksum="yes"/> | ||
</Component> | ||
<Component Win64="$(var.Win64)"> | ||
<File Id="net461_System.Runtime.InteropServices.RuntimeInformation.dll" | ||
Source="$(var.ManagedDllPath)\net461\System.Runtime.InteropServices.RuntimeInformation.dll" | ||
KeyPath="yes" Checksum="yes"/> | ||
</Component> | ||
<Component Win64="$(var.Win64)"> | ||
<File Id="net461_System.Security.Cryptography.Algorithms.dll" | ||
Source="$(var.ManagedDllPath)\net461\System.Security.Cryptography.Algorithms.dll" | ||
KeyPath="yes" Checksum="yes"/> | ||
</Component> | ||
<Component Win64="$(var.Win64)"> | ||
<File Id="net461_System.Security.Cryptography.Encoding.dll" | ||
Source="$(var.ManagedDllPath)\net461\System.Security.Cryptography.Encoding.dll" | ||
KeyPath="yes" Checksum="yes"/> | ||
</Component> | ||
<Component Win64="$(var.Win64)"> | ||
<File Id="net461_System.Security.Cryptography.Primitives.dll" | ||
Source="$(var.ManagedDllPath)\net461\System.Security.Cryptography.Primitives.dll" | ||
KeyPath="yes" Checksum="yes"/> | ||
</Component> | ||
<Component Win64="$(var.Win64)"> | ||
<File Id="net461_System.Security.Cryptography.X509Certificates.dll" | ||
Source="$(var.ManagedDllPath)\net461\System.Security.Cryptography.X509Certificates.dll" | ||
KeyPath="yes" Checksum="yes"/> | ||
</Component> | ||
</ComponentGroup> | ||
</Fragment> | ||
</Wix> |
Oops, something went wrong.