-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
Description
When run the 3rd party unitest against with dotnet-sdk-10.0.100-alpha.1.25067.41, there are 8 cases failed with error:
System.Collections.Generic.KeyNotFoundException : The given key '4630cad0-5365-4dd5-8ccb-496ffd04d672' was not present in the dictionary. After investigation, we found it is caused by System.Diagnostics.StartActivity().Recorded return false on dotnet-sdk-10.0.100-alpha.1.25067.41.
Reproduction Steps
Minimal Repro Steps: (Attached Demo:ConsoleDemo.zip):
- Create .net 9.0 console project.
- Add the following code to Program.cs.
using System.Diagnostics;
var listener = new ActivityListener
{
ShouldListenTo = _ => true,
Sample = (ref ActivityCreationOptions<ActivityContext> options) => ActivitySamplingResult.AllData,
};
ActivitySource.AddActivityListener(listener);
Activity activity = new ActivitySource("").StartActivity(ActivityKind.Client,
new ActivityContext(new ActivityTraceId(), new ActivitySpanId(), ActivityTraceFlags.Recorded));
Console.WriteLine(activity.Recorded);
- Build the app.
- Change the runtimeconfig file to let the app run against with dotnet-sdk-10.0.100-alpha.1.25067.41:
"frameworks": [
{
"name": "Microsoft.NETCore.App",
"version": "10.0.0-alpha.1.25067.10"
}
]
- Run the app.
Expected Result:
Return true.
Actual Result:
Return false.
App Repro Steps:
- Change the \App\opentelemetrydotnetTest01\OpenTelemetry.Exporter.Zipkin.Tests.runtimeconfig file to let the app run against with dotnet-sdk-10.0.100-alpha.1.25067.41:
"frameworks": [
{
"name": "Microsoft.NETCore.App",
"version": "10.0.0-alpha.1.25067.10"
}
]
- Open cmd.
- Cd to "\App\opentelemetrydotnetTest01".
- Run command "dotnet vstest OpenTelemetry.Exporter.Zipkin.Tests.dll".
Expected behavior
All cases passed.
Actual behavior
There are 8 cases failed with error:
System.Collections.Generic.KeyNotFoundException : The given key '4630cad0-5365-4dd5-8ccb-496ffd04d672' was not present in the dictionary.
Stack Trace:
at System.Collections.Concurrent.ConcurrentDictionary`2.ThrowKeyNotFoundException(TKey key)
at System.Collections.Concurrent.ConcurrentDictionary`2.get_Item(TKey key)
at OpenTelemetry.Exporter.Zipkin.Tests.ZipkinExporterTests.IntegrationTest(Boolean useShortTraceIds, Boolean useTestResource, Boolean isRootSpan, StatusCode statusCode, String statusDescription, Boolean addErrorTag) in D:\opentelemetry-dotnet\test\OpenTelemetry.Exporter.Zipkin.Tests\ZipkinExporterTests.cs:line 409
at InvokeStub_ZipkinExporterTests.IntegrationTest(Object, Span`1)
at System.Reflection.MethodBaseInvoker.InvokeWithManyArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
Regression?
Yes
Verify Scenarios:
1). Windows 10 22H2 AMD64 + dotnet-sdk-8.0.405: Pass
2). Windows 10 22H2 AMD64 + dotnet-sdk-9.0.102: Pass
3). Windows 10 22H2 AMD64 + dotnet-sdk-10.0.100-alpha.1.25067.41: Fail
Known Workarounds
No response
Configuration
Application Name: opentelemetrydotnet
OS: Windows 10 22H2
CPU: X64
.NET Build Number: dotnet-sdk-10.0.100-alpha.1.25067.41
App & Source Location checking at: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2350449
Github Link: https://github.com/open-telemetry/opentelemetry-dotnet
Other information
@dotnet-actwx-bot @dotnet/compat