Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collection was modified; enumeration operation may not execute #2091

Closed
valeraf23 opened this issue Jun 17, 2021 · 1 comment
Closed

Collection was modified; enumeration operation may not execute #2091

valeraf23 opened this issue Jun 17, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@valeraf23
Copy link

Bug Report

<PackageReference Include="OpenTelemetry" Version="1.1.0-beta4" />
<PackageReference Include="OpenTelemetry.Api" Version="1.1.0-beta4" />
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.1.0-beta4" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.1.0-beta4" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.0.0-rc5" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.0.0-rc5" />

Symptom

            services.AddOpenTelemetryTracing(builder =>
            {
                builder.Configure(
                    (sp, b) => b.AddAspNetCoreInstrumentation());
            });

            var tracerFactory = serviceProvider.GetRequiredService<TracerProvider>();

occurred exception
System.InvalidOperationException: 'Collection was modified; enumeration operation may not execute.'

The reason that AddAspNetCoreInstrumentation method also executes builder. Configure method. But for my point of view if I can call AddAspNetCoreInstrumentation from the builder. Configure there are should not be exceptions

@valeraf23 valeraf23 added the bug Something isn't working label Jun 17, 2021
@CodeBlanch
Copy link
Member

Should be fixed with #2080

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants