Skip to content

Obscure NullReferenceException if server does not provide a Content-Type header in polling transport  #18

Open

Description

@vsoldatkin

You'll get a null reference here: https://github.com/Quobject/EngineIoClientDotNet/blob/master/Src/EngineIoClientDotNet.mono/Client/Transports/PollingXHR.cs#L328

It is accessed later in an octet-stream check producing a NullReferenceException which is quite hard to grasp using a release nuget build.

Activity

  1. mattqs commented on Jan 23, 2016

    @mattqs
    Contributor

    Why is it hard to grasp?

  2. vsoldatkin commented on Jan 23, 2016

    @vsoldatkin
    Author

    If someone uses a release build published in nuget he gets no info about the exception at all, which makes it impossible to know what exatcly went wrong and how one should fix that.

    Aside of that, do you by closing this issue mean you don't acknowlege this as a bug? I'm not talking about the obscurity, it is about the exception while processing the response with no header. Note that Content-Type header is optional.

  3. mattqs commented on Jan 23, 2016

    @mattqs
    Contributor

    OK, Reopened. Please provide a stacktrace.

  4. reopened this on Jan 23, 2016
  5. vsoldatkin commented on Jan 25, 2016

    @vsoldatkin
    Author

    This is what the immediate call stack looks like (via IntelliTrace):

    >   EngineIoClientDotNet.dll!XHRRequest.AnonymousMethod()   
        mscorlib.dll!System.Threading.Tasks.Task.InnerInvoke()  
        mscorlib.dll!System.Threading.Tasks.Task.Execute()  
        mscorlib.dll!System.Threading.Tasks.Task.ExecutionContextCallback(object obj = {unknown})   
        mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext = {unknown}, System.Threading.ContextCallback callback = {unknown}, object state = {unknown}, bool preserveSyncCtx = {unknown})   
        mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext = {unknown}, System.Threading.ContextCallback callback = {unknown}, object state = {unknown}, bool preserveSyncCtx = {unknown})   
        mscorlib.dll!System.Threading.Tasks.Task.ExecuteWithThreadLocal(ref System.Threading.Tasks.Task currentTaskSlot = {unknown})    
        mscorlib.dll!System.Threading.Tasks.Task.ExecuteEntry(bool bPreventDoubleExecution = {unknown}) 
        mscorlib.dll!System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() 
        mscorlib.dll!System.Threading.ThreadPoolWorkQueue.Dispatch()    
        mscorlib.dll!System.Threading._ThreadPoolWaitCallback.PerformWaitCallback() 
    

    Here is an error message from the Socket.IO connect_error handler:

    Quobject.EngineIoClientDotNet.Client.EngineIOException: xhr poll error ---> System.AggregateException ---> System.NullReferenceException
       в Quobject.EngineIoClientDotNet.Client.Transports.PollingXHR.XHRRequest.<Create>b__2()
       в System.Threading.Tasks.Task.InnerInvoke()
       в System.Threading.Tasks.Task.Execute()
       --- End of inner exception stack trace ---
       в System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
       в System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
       в System.Threading.Tasks.Task.Wait()
       в Quobject.EngineIoClientDotNet.Client.Transports.PollingXHR.XHRRequest.Create()
       --- End of inner exception stack trace ---
    

    Not really informative, aren't they? The exact cause is provided in the first post.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions