Skip to content

System.ArgumentNullException: Value cannot be null. (Parameter 'value') in .net Maui on Android when using WebSockets #430

@Laradius

Description

@Laradius

{System.ArgumentNullException: Value cannot be null. (Parameter 'value')
at GraphQL.Client.Http.Websocket.GraphQLHttpWebSocket.<>c__DisplayClass27_0`1[[ProgramClassHere, ProgramNameHere, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].b__3(Exception e) in /_/src/GraphQL.Client/Websocket/GraphQLHttpWebSocket.cs:line 211}

It happens when initializing websocket connection (either directly or by subscription stream).

The unhandled exception happens at line 402 of GraphQLHttpWebSocket.cs

_clientWebSocket.Options.ClientCertificates = ((HttpClientHandler)Options.HttpMessageHandler).ClientCertificates;

The error being thrown after execution of it at line 211 is due to X509CertificateCollection ArgumentNullException

if (!(e is WebSocketException)) throw e;

Error:

{System.ArgumentNullException: Value cannot be null. (Parameter 'value')
   at System.Net.WebSockets.ClientWebSocketOptions.set_ClientCertificates(X509CertificateCollection value)
   at GraphQL.Client.Http.Websocket.GraphQLHttpWebSocket.InitializeWebSocket() in [redacted]
   at GraphQL.Client.Http.Websocket.GraphQLHttpWebSocket.<>c__DisplayClass27_0`1.<<CreateSubscriptionStream>b__5>d[[-.Models.GraphQLModels.ResposeTypes.ProjectResponseType, -, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext() in [redacted] src\GraphQL.Client\Websocket\GraphQLHttpWebSocket.cs:line 157}

It works fine on Windows, however it breaks on Android.

Will this client be compatible with .NET MAUI?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions