Skip to content

[bug] WCF tracing instrumentation fails when using WCF Web HTTP Help Pages #2584

Open
@OGCdefi

Description

@OGCdefi

Component

OpenTelemetry.Instrumentation.Wcf

Package Version

Package Name Version
OpenTelemetry.Api 1.8.0
OpenTelemetry 1.8.0
TBD TBD

Runtime Version

net472

Description

Using the autogenerated "WCF Web HTTP Help Pages" (see more about those here) causes the WCF tracing instrumentation to throw an exception similar to the one below.

WebHost failed to process a request.
 Sender Information: System.ServiceModel.Activation.HostedHttpRequestAsyncResult/16483014
 Exception: System.ServiceModel.ServiceActivationException: The service '/MyService.svc' cannot be activated due to an exception during compilation.  The exception message is: Value cannot be null.
Parameter name: key. ---> System.ArgumentNullException: Value cannot be null.
Parameter name: key
   at System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at OpenTelemetry.Instrumentation.Wcf.TelemetryEndpointBehavior.ApplyDispatchBehaviorToEndpoint(EndpointDispatcher endpointDispatcher)
   at System.ServiceModel.Description.DispatcherBuilder.InitializeServiceHost(ServiceDescription description, ServiceHostBase serviceHost)
   at System.ServiceModel.ServiceHostBase.InitializeRuntime()
   at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(ServiceActivationInfo serviceActivationInfo, EventTraceActivity eventTraceActivity)
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity)
   --- End of inner exception stack trace ---
   at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
   at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)
 Process Name: w3wp
 Process ID: 8416

The usage and autogeneration of these "WCF Web HTTP Help Pages" is controlled in the Web.config, and more specifically by <webHttp helpEnabled="true" ... >
These help pages are disabled by default, but if you have them, the autogenerated endpoint will lack the necessary "Action" and this will cause the instrumentation to blow up.

Screenshot below shows the workaround, which is disabling the help pages.
Image

Screenshot below shows a sample help page:

Image

Steps to Reproduce

  1. Add the automatic WCF instrumentation to the Tracer provider.
  2. Add the instrumentation to an endpoint behavior.
  3. Enable help pages for the same endpoint.
  4. Run the app and observe the exception when trying to hit the service endpoint.

Expected Result

Either the help pages should be excluded from instrumentation or they need to be handled properly.

Actual Result

An exception is thrown.

Exception: System.ServiceModel.ServiceActivationException: The service '/MyService.svc' cannot be activated due to an exception during compilation.  The exception message is: Value cannot be null.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcomp:instrumentation.wcfThings related to OpenTelemetry.Instrumentation.Wcf

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions