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

Extension method invocations are not simplified #1026

Open
voroninp opened this issue Jul 24, 2023 · 1 comment
Open

Extension method invocations are not simplified #1026

voroninp opened this issue Jul 24, 2023 · 1 comment

Comments

@voroninp
Copy link

This code

Dim tracingBuilder as TracerProviderBuilder = Sdk.CreateTracerProviderBuilder() _
    .ConfigureResource(
        Sub(c)
            c.AddService("MediaViewServer") _
             .AddAttributes(New Dictionary(Of String, Object) _
                            From {{"License", gLicenceDC.GetInstance().LicenseCode}})
        End Sub) _
    .SetErrorStatusOnException() _
    .AddWcfInstrumentation() _
    .AddGrpcCoreInstrumentation() _
    .AddOtlpExporter(
        Sub(c)
            c.ExportProcessorType = ExportProcessorType.Batch
            c.BatchExportProcessorOptions = New BatchExportProcessorOptions(Of Activity) _
                        With {.ExporterTimeoutMilliseconds = 5000}
            c.Endpoint = New Uri(tracingUrl)
            c.Protocol = otlpExportProtocol
        End Sub) _
    .AddSource(GetType(EnumerableAsLz4EncodedStream(Of ClassificationsChunk)).FullName) _
    .AddSource(GetType(EnumerableAsLz4EncodedStream(Of RmaDataChunk)).FullName) _
    .AddSource(GetType(NloRadioMarketAnalysisStreamingServiceCore).FullName)

turns into:

var tracingBuilder = 
    OpenTelemetry.Trace.TracerProviderBuilderExtensions.AddGrpcCoreInstrumentation(
        OpenTelemetry.Trace.TracerProviderBuilderExtensions.AddWcfInstrumentation(
            OpenTelemetry.Trace.TracerProviderBuilderExtensions.SetErrorStatusOnException(
                OpenTelemetry.Trace.TracerProviderBuilderExtensions.ConfigureResource(
                    Sdk.CreateTracerProviderBuilder(), 
                    c => ResourceBuilderExtensions.AddService(c, "MediaViewServer")
                        .AddAttributes((IEnumerable<KeyValuePair<string, object>>)new Dictionary<string, object>() { { "License", gLicenceDC.GetInstance().LicenseCode } })))))
    .AddOtlpExporter(c =>
                    {
    c.ExportProcessorType = ExportProcessorType.Batch;
    c.BatchExportProcessorOptions = new BatchExportProcessorOptions<Activity>() { ExporterTimeoutMilliseconds = 5000 };
    c.Endpoint = new Uri(tracingUrl);
    c.Protocol = otlpExportProtocol;
    })
    .AddSource(typeof(EnumerableAsLz4EncodedStream<ClassificationsChunk>).FullName)
    .AddSource(typeof(EnumerableAsLz4EncodedStream<RmaDataChunk>).FullName).AddSource(typeof(NloRadioMarketAnalysisStreamingServiceCore).FullName);

However, nested methods are extension methods.
Installed extension: 9.2.3.0

@GrahamTheCoder
Copy link
Member

Thanks for report. I think this might either be a bug in, or be caused by a workaround for a bug in, the roslyn simplifier. I'll try to repro and see what can be done though

@GrahamTheCoder GrahamTheCoder changed the title Extension methods are not properly converted. Extension method invocations are not simplified Jul 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants