Skip to content

Unity / Mono - ClientCertificates NotImplementedException #324

Closed
@dwelch2344

Description

@dwelch2344

Hey @rose-a, new to .NET / Unity but I think I'm running into the #318 ClientWebSocket issue still with 3.2.1 - same scenario as OP but on Mac. The difference I'm seeing is that I'm getting a System.NotImplementedException instead of a PlatformNotSupportedException so the try / catch doesn't do anything.

I can trap the Exception to print it out, and it ends up looking like this:

Subscription Exception Handler - System.NotImplementedException: The method or operation is not implemented.
  at System.Net.Http.HttpClientHandler.get_ClientCertificates () [0x00000] in <7ebf3529ba0e4558a5fa1bc982aa8605>:0 
  at GraphQL.Client.Http.Websocket.GraphQLHttpWebSocket.InitializeWebSocket () [0x000b5] in <a79a8e26596a4659b989a8e130b9b057>:0 
  at GraphQL.Client.Http.Websocket.GraphQLHttpWebSocket+<>c__DisplayClass27_0`1+<<CreateSubscriptionStream>b__5>d[TResponse].MoveNext () [0x00148] in <a79a8e26596a4659b989a8e130b9b057>:0 
UnityEngine.Debug:Log(Object)
<>c:<DoIt>b__4_0(Exception) (at Assets/Api.cs:55)
GraphQL.Client.Http.Websocket.<>c__DisplayClass27_0`1:<CreateSubscriptionStream>b__3(Exception)
System.Reactive.BasicProducer`1:Subscribe(IObserver`1)
GraphQL.Client.Http.Websocket.<<CreateSubscriptionStream>b__5>d:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:Start(<<CreateSubscriptionStream>b__5>d&)
GraphQL.Client.Http.Websocket.<>c__DisplayClass27_0`1:<CreateSubscriptionStream>b__5(IObserver`1)
System.ObservableExtensions:Subscribe(IObservable`1, Action`1)
Api:DoIt() (at Assets/Api.cs:59)
CharacterInventory:TestEquip() (at Assets/CharacterInventory.cs:38)
UnityEngine.EventSystems.EventSystem:Update() (at /Applications/Unity/Hub/Editor/2019.4.18f1/Unity.app/Contents/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/EventSystem.cs:377)

Is it possible that the certificate library that I've got configured is throwing a different exception than other runtimes or something? Would it be safe to catch both exceptions?

Any help would be appreciated :)

From the Java / Node world by trade, so excuse my sloppy code. Included for reference tho ;)

public class Api { 
    private GraphQLHttpClient client;




    public class Response
    {
        public Post postAdded { get; set; }
    }


    public class Post
    {
        public string author { get; set; }
        public string comment { get; set; }
    }

    public void Start()
    {
        client = new GraphQLHttpClient("http://localhost:4000/graphql", new NewtonsoftJsonSerializer());
        
    }

    public bool DoIt()
    {
        Debug.Log("About to start?");
        var query = new GraphQL.GraphQLRequest
        {
            Query = @"subscription {
                postAdded{
                author
                comment
                }
            }"
        };

            //IObservable<GraphQL.GraphQLResponse<Response>> subscriptionStream = client.CreateSubscriptionStream<Response>(query);
            IObservable<GraphQL.GraphQLResponse<Response>> subscriptionStream = client.CreateSubscriptionStream<Response>(query, ex =>
            {
                Debug.Log("Failed?!? " + ex);
                throw ex;
            });

            var subscription = subscriptionStream.Subscribe(response =>{
                Debug.Log("Got a response");
                Response thing = response.Data;
                Debug.LogFormat("{0} by {1}", thing.postAdded.comment, thing.postAdded.comment);
            });

            Debug.Log("Opened? " + subscription);
    }
}
            

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