-
Notifications
You must be signed in to change notification settings - Fork 867
Description
Bug Report
List of all OpenTelemetry NuGet
packages and version that you are
using (e.g. OpenTelemetry 1.0.2):
OpenTelemetry 1.7.0OpenTelemetry.Exporter.OpenTelemetryProtocol 1.7.0
Runtime version (e.g. net462, net48, netcoreapp3.1, net6.0 etc. You can
find this information from the *.csproj file): net8.0
Symptom
When compiling with PublishAot=true, I get an System.PlatformNotSupportedException from an unknown origin in the code
What is the expected behavior?
App should output without error
pre otel
post otel
What is the actual behavior?
The application would throw an exception at startup:
pre otel
Unhandled Exception: System.PlatformNotSupportedException: Operation is not supported on this platform.
at System.Runtime.InteropServices.Marshal.GetExceptionPointers() + 0x28
at OpenTelemetry.Trace.ExceptionProcessor.OnStart(Activity) + 0x20
at System.Diagnostics.SynchronizedList`1.EnumWithAction(Action`2, Object) + 0xe4
at System.Diagnostics.Activity.Start() + 0x188
at System.Diagnostics.Activity.Create(ActivitySource, String, ActivityKind, String, ActivityContext, IEnumerable`1, IEnumerable`1, DateTimeOffset, ActivityTagsCollection, ActivitySamplingRe
sult, Boolean, ActivityIdFormat, String) + 0x328
at System.Diagnostics.ActivitySource.CreateActivity(String, ActivityKind, ActivityContext, String, IEnumerable`1, IEnumerable`1, DateTimeOffset, Boolean, ActivityIdFormat) + 0x4d4
at System.Diagnostics.ActivitySource.StartActivity(String, ActivityKind) + 0x40
at Program.<Main>$(String[] args) + 0xfc
at dotnet-otel-bug!<BaseAddress>+0x239d08
[1] 80113 abort
Reproduce
Code in : https://github.com/kedare/dotnet-otel-bug/
Try without AOT, it should work fine :
dotnet publish -c Release --sc --use-current-runtime
Try with AOT, it should throw the exception after the pre otel console output
dotnet publish -c Release --sc --use-current-runtime -p:PublishAot=true
Additional Context
Tested in MacOs (build to Mac binary)
Tested inside docker (build to Linux binary)
I first though the issue was from the AddSource("*") as then I remove it the issue is gone but I guess it's just because then it's not gathering any trace and not hitting the part of the opentelemetry code that triggers this issue)