none
WCF unhandled exception RRS feed

  • Question

  • hi

    i'm using wcf service and got the following exception:

    Unhandled exception has occured

    System.NullReferenceException: Object reference not set to an instance of an object.
       at System.ServiceModel.Channels.ReliableChannelBinder`1.ChannelSynchronizer.RemoveWaiter(IWaiter waiter)
       at System.ServiceModel.Channels.ReliableChannelBinder`1.ChannelSynchronizer.AsyncWaiter.OnTimeoutElapsed()
       at System.Runtime.IOThreadScheduler.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
       at System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)
       at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)

    how can i handle such exception? 

    avoid it?

    overcome it?

    thanks

    Monday, December 9, 2013 10:05 PM

Answers

  • Hi,

    For handling such exception, first please try to turn on the includeExceptionDetailInFaults as following:

    <serviceBehaviors>
                    <behavior name="ServiceGatewayBehavior">
                      <serviceDebug includeExceptionDetailInFaults="true"/>
                    </behavior>
            </serviceBehaviors>

    Then please try to enable the wcf trace.

    The following configuration taken from MSDN can be applied to enable tracing on your WCF service.

    <configuration>
      <system.diagnostics>
        <sources>
          <source name="System.ServiceModel"
                  switchValue="Information, ActivityTracing"
                  propagateActivity="true" >
            <listeners>
                 <add name="xml"/>
            </listeners>
          </source>
          <source name="System.ServiceModel.MessageLogging">
            <listeners>
                <add name="xml"/>
            </listeners>
          </source>
          <source name="myUserTraceSource"
                  switchValue="Information, ActivityTracing">
            <listeners>
                <add name="xml"/>
            </listeners>
          </source>
        </sources>
        <sharedListeners>
            <add name="xml"
                 type="System.Diagnostics.XmlWriterTraceListener"
                 initializeData="Error.svclog" />
        </sharedListeners>
      </system.diagnostics>
    </configuration>
    Best Regards,
    Amy Peng

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, December 10, 2013 2:31 AM
    Moderator
  • Hi,

    The "Unhandled exception has occured" is just a general error, we can use the function I mentioned in the my first reply to get the detailed error message. Then only that we can get the real root case of the problem. Then we can avoid it next time.

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, December 16, 2013 2:12 AM
    Moderator

All replies

  • Hi,

    For handling such exception, first please try to turn on the includeExceptionDetailInFaults as following:

    <serviceBehaviors>
                    <behavior name="ServiceGatewayBehavior">
                      <serviceDebug includeExceptionDetailInFaults="true"/>
                    </behavior>
            </serviceBehaviors>

    Then please try to enable the wcf trace.

    The following configuration taken from MSDN can be applied to enable tracing on your WCF service.

    <configuration>
      <system.diagnostics>
        <sources>
          <source name="System.ServiceModel"
                  switchValue="Information, ActivityTracing"
                  propagateActivity="true" >
            <listeners>
                 <add name="xml"/>
            </listeners>
          </source>
          <source name="System.ServiceModel.MessageLogging">
            <listeners>
                <add name="xml"/>
            </listeners>
          </source>
          <source name="myUserTraceSource"
                  switchValue="Information, ActivityTracing">
            <listeners>
                <add name="xml"/>
            </listeners>
          </source>
        </sources>
        <sharedListeners>
            <add name="xml"
                 type="System.Diagnostics.XmlWriterTraceListener"
                 initializeData="Error.svclog" />
        </sharedListeners>
      </system.diagnostics>
    </configuration>
    Best Regards,
    Amy Peng

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, December 10, 2013 2:31 AM
    Moderator
  • thank you for you quick reply.

    are you familiar with such behavior? how can i avoid from my application to crash due to such an error?

    Tuesday, December 10, 2013 10:17 AM
  • Hi,

    The "Unhandled exception has occured" is just a general error, we can use the function I mentioned in the my first reply to get the detailed error message. Then only that we can get the real root case of the problem. Then we can avoid it next time.

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, December 16, 2013 2:12 AM
    Moderator