Skip to content
This repository was archived by the owner on Jul 1, 2025. It is now read-only.
This repository was archived by the owner on Jul 1, 2025. It is now read-only.

NullReferenceException in Glimpse.Wcf.GlimpseWcfClientInspector.BeforeSendRequest() when request.Headers.MessageId is null #1

@szmalec

Description

@szmalec

Hi. Thank you for great work!

  1. I would like to report first small issue (?). In current sources (GlimpseEndpointBehavior.cs) I see commented line:
        public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
        {            
            //clientRuntime.MessageInspectors.Add(new GlimpseWcfClientInspector());
        }

Are you sure that line should be commented?

  1. I would like to report second small issue. I have encountered following exception when using Glimpse.Wcf:
System.NullReferenceException was unhandled by user code
  HResult=-2147467261
  Message=Object reference not set to an instance of an object.
  Source=Glimpse.Wcf
  StackTrace:
       w Glimpse.Wcf.GlimpseWcfClientInspector.BeforeSendRequest(Message& request, IClientChannel channel) w (...)\Glimpse.WCF\GlimpseWcfClientInspector.cs:row 41
       w System.ServiceModel.Dispatcher.ImmutableClientRuntime.BeforeSendRequest(ProxyRpc& rpc)

Problem occured in line:

MessageId = request.Headers.MessageId.ToString()

Problem occured because in my WCF configuration request.Headers.MessageId is null (ref1).

I have tried to add following code:

            if (request.Headers.MessageId == null)
                request.Headers.MessageId = new UniqueId(Guid.NewGuid());

but it throws an exception:

System.InvalidOperationException: Addressing Version 'AddressingNone (http://schemas.microsoft.com/ws/2005/05/addressing/none)' does not support adding WS-Addressing headers.

Everything looks OK when problematic line is replaced by following code:

MessageId = (request.Headers.MessageId != null ? request.Headers.MessageId : new UniqueId(Guid.NewGuid())).ToString(),

  1. Do you plan to publish Glimpse.WCF as a NuGet package?

  1. It would be helpful if there would be included (in README.md) informations how to enable GlimseWcfInspector on configuration level (see ref1 <== ref2

Sorry for non issue related stuff in this post.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions