-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disable optimizations to avoid AutoMapper error caused by runtime bug (…
…#363) * add AutomapperTest project with Docker support * update .dockerignore file and add to solution items * autoformat code * move event mask into Initialize(), no longer constant * get ICorProfilerInfo3 earlier during Initialize() * add new env var to disable all CLR optimizations * move DisableOptimizations from cor_profiler to clr_helpers * fix parameter name in header file
- Loading branch information
1 parent
c447361
commit 35e0fa0
Showing
12 changed files
with
222 additions
and
44 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,11 @@ | ||
.git/ | ||
test/ | ||
.vs/ | ||
deploy/ | ||
|
||
.circleci/ | ||
.git/ | ||
.github/ | ||
.vs/ | ||
.vscode/ | ||
packages/ | ||
**/bin/ | ||
**/obj/ |
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,31 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFrameworks>netcoreapp2.2;netcoreapp2.1;netcoreapp2.0</TargetFrameworks> | ||
<Platforms>x64;x86</Platforms> | ||
<PlatformTarget>$(Platform)</PlatformTarget> | ||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS> | ||
<DockerfileContext>..\..</DockerfileContext> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="AutoMapper" Version="8.1.0" /> | ||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.7.8" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\Datadog.Trace.ClrProfiler.Managed\Datadog.Trace.ClrProfiler.Managed.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Include="..\..\src\Datadog.Trace.ClrProfiler.Native\bin\$(Configuration)\$(Platform)\**" | ||
CopyToOutputDirectory="Always" | ||
CopyToPublishDirectory="Always" | ||
Link="profiler-lib\%(RecursiveDir)\%(Filename)%(Extension)" /> | ||
<Content Include="..\..\integrations.json" | ||
CopyToOutputDirectory="Always" | ||
CopyToPublishDirectory="Always" | ||
Link="profiler-lib\integrations.json" /> | ||
</ItemGroup> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
FROM mcr.microsoft.com/dotnet/core/runtime:2.1-stretch-slim AS base | ||
ARG TRACER_VERSION=1.2.0 | ||
RUN mkdir -p /opt/datadog | ||
RUN mkdir -p /var/log/datadog | ||
RUN curl -L https://github.com/DataDog/dd-trace-dotnet/releases/download/v$TRACER_VERSION/datadog-dotnet-apm-$TRACER_VERSION.tar.gz | tar xzf - -C /opt/datadog | ||
|
||
ENV CORECLR_ENABLE_PROFILING=1 | ||
ENV CORECLR_PROFILER={846F5F1C-F9AE-4B07-969E-05C26BC060D8} | ||
ENV CORECLR_PROFILER_PATH=/opt/datadog/Datadog.Trace.ClrProfiler.Native.so | ||
ENV DD_INTEGRATIONS=/opt/datadog/integrations.json | ||
ENV DD_TRACE_ENABLED=true | ||
|
||
FROM mcr.microsoft.com/dotnet/core/sdk:2.1-stretch AS build | ||
WORKDIR "/src" | ||
COPY ["reproductions/AutomapperTest/AutomapperTest.csproj", "/src/reproductions/AutomapperTest/"] | ||
COPY ["src/Datadog.Trace.ClrProfiler.Managed/Datadog.Trace.ClrProfiler.Managed.csproj", "/src/src/Datadog.Trace.ClrProfiler.Managed/"] | ||
COPY ["src/Datadog.Trace/Datadog.Trace.csproj", "/src/src/Datadog.Trace/"] | ||
RUN dotnet restore "/src/reproductions/AutomapperTest/AutomapperTest.csproj" | ||
COPY . . | ||
WORKDIR "/src/reproductions/AutomapperTest" | ||
RUN dotnet build "AutomapperTest.csproj" -c Release -o /app | ||
|
||
FROM build as publish | ||
RUN dotnet publish "AutomapperTest.csproj" -c Release -o /app | ||
|
||
FROM base AS final | ||
WORKDIR /app | ||
COPY --from=publish /app . | ||
ENTRYPOINT ["dotnet", "AutomapperTest.dll"] |
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,34 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using AutoMapper; | ||
using Datadog.Trace.ClrProfiler; | ||
|
||
namespace AutomapperTest | ||
{ | ||
public class Program | ||
{ | ||
public static void Main() | ||
{ | ||
Console.WriteLine($"Profiler attached: {Instrumentation.ProfilerAttached}"); | ||
|
||
Mapper.Initialize( | ||
configuration => | ||
{ | ||
configuration.CreateMap<Model1, Model2>(); | ||
}); | ||
|
||
Console.WriteLine("Done"); | ||
} | ||
} | ||
|
||
public class Model1 | ||
{ | ||
public List<string> Items { get; set; } | ||
} | ||
|
||
public class Model2 | ||
{ | ||
// changing this to string[] avoids the problem | ||
public List<string> Items { get; set; } | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
reproductions/AutomapperTest/Properties/launchSettings.json
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,22 @@ | ||
{ | ||
"profiles": { | ||
"AutomapperTest": { | ||
"commandName": "Project", | ||
"nativeDebugging": true, | ||
"environmentVariables": { | ||
"COR_ENABLE_PROFILING": "1", | ||
"COR_PROFILER": "{846F5F1C-F9AE-4B07-969E-05C26BC060D8}", | ||
"COR_PROFILER_PATH": "$(ProjectDir)$(OutputPath)profiler-lib\\Datadog.Trace.ClrProfiler.Native.dll", | ||
|
||
"CORECLR_ENABLE_PROFILING": "1", | ||
"CORECLR_PROFILER": "{846F5F1C-F9AE-4B07-969E-05C26BC060D8}", | ||
"CORECLR_PROFILER_PATH": "$(ProjectDir)$(OutputPath)profiler-lib\\Datadog.Trace.ClrProfiler.Native.dll", | ||
|
||
"DD_INTEGRATIONS": "$(ProjectDir)$(OutputPath)profiler-lib\\integrations.json" | ||
} | ||
}, | ||
"Docker": { | ||
"commandName": "Docker" | ||
} | ||
} | ||
} |
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,6 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<IsPackable>false</IsPackable> | ||
<GenerateDocumentationFile>false</GenerateDocumentationFile> | ||
</PropertyGroup> | ||
</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
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