EventStore.ClientAPI.Transport.Tcp.TcpPackageConnection issue when connecting to subscription

Does anybody know why I would be getting this when connecting to a subscription? I have tried changing the settings on the subscription to be smaller but still no luck. This is all get and can’t drill into the detail.

An unhandled exception of type ‘System.TypeInitializationException’ occurred in EventStore.ClientAPI.NetCore.dll
Additional information: The type initializer for ‘EventStore.ClientAPI.Transport.Tcp.TcpPackageConnection’ threw an exception.

Thanks in advance, Onam.

Can you please open an issue on github and tag it [dotnet-core]?
Also can you possibly provide some more information like how you are connecting and verbose logging enabled etc?

Yup I'll do that. I essentially copied this example https://github.com/EventStore/EventStore.Samples.Dotnet/blob/master/PersistentSubscription/Program.cs. The only thing that I've done custom is creating the projection manually via the UI. I'll try to replicate on another machine and post the details on git.

Are you running it on coreclr?

Yes using core CLR. Trying to replicate the issue on my laptop but unable to do so. A different issue but if I am able to replicate the previous I will post it will full details. This is what I am getting right now after enabling verbose logging:

Unhandled Exception: System.AggregateException: One or more errors occurred. (One or more errors occurred. (Connection ‘ES-d26c1c45-e10e-4348-9cfc-73f8fc0891c2’ was closed.)) —> System.AggregateException: One or more errors occurred. (Connection ‘ES-d26c1c45-e10e-4348-9cfc-73f8fc0891c2’ was closed.) —> EventStore.ClientAPI.Exceptions.ConnectionClosedException: Connection ‘ES-d26c1c45-e10e-4348-9cfc-73f8fc0891c2’ was closed.

— End of inner exception stack trace —

at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)

at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)

at EventStore.ClientAPI.EventStorePersistentSubscriptionBase.b__19_0(Task`1 t)

at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()

at System.Threading.Tasks.Task.Execute()

— End of inner exception stack trace —

at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)

at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)

at System.Threading.Tasks.Task.Wait()

at EventStore.ClientAPI.Internal.EventStoreNodeConnection.ConnectToPersistentSubscription(String stream, String groupName, Action2 eventAppeared, Action3 subscriptionDropped, UserCredentials userCredentials, Int32 bufferSize, Boolean autoAck)

at PayPal.Subscription.Endpoint.Program.Main(String[] args)

This is the code:

public static class Program
{
    public static void Main(string[] args)
    {
        using (var conn = EventStoreConnection.Create(
            @"ConnectTo=tcp://admin:changeit@localhost:2113; HeartBeatTimeout=500"))
        {
            try
            {
                conn.ConnectAsync().Wait();
                var set = PersistentSubscriptionSettings.Create().StartFromCurrent();
                conn.CreatePersistentSubscriptionAsync("Foo", "agroup", set, new UserCredentials("admin", "changeit")).Wait();
                Console.Read();
            }
            catch (Exception ex)
            {
                throw;
            }
        }
    }

    private static void SubscriptionDropped(EventStorePersistentSubscriptionBase eventStorePersistentSubscriptionBase, SubscriptionDropReason subscriptionDropReason, Exception arg3)
    {
    }

    private static void EventAppeared(EventStorePersistentSubscriptionBase eventStorePersistentSubscriptionBase, ResolvedEvent resolvedEvent)
    {
    }

``

Project json:

{
“version”: “1.0.0-0”,
“buildOptions”: {
“emitEntryPoint”: true,
“debugType”: “portable”,
“preserveCompilationContext”: true
},
“dependencies”: {
“Microsoft.AspNetCore.Hosting”: “1.0.0”,
“Microsoft.AspNetCore.Server.Kestrel”: “1.0.0”,
“Microsoft.AspNetCore.Server.WebListener”: “0.1.0”,
“EventStore.ClientAPI.NetCore”:“0.0.1-alpha”,
“Microsoft.NETCore.App”: {
“version”: “1.0.0”,
“type”: “platform”
}
},
“frameworks”: {
“netcoreapp1.6”: {
“imports”: [
“dnxcore50”
]
}
}
}

``

You are connecting to the http port try 1113

Apologies yes, I changed that and it works fine. Though the original issue still trying to replicate. I think it is related to using the 461 framework. Its just a hunch but that was a change I did and it started throwing the exception mentioned in the subject. I am going to give this another try now and verify. It works when using Core CLR only.