OpenTl.ClientApi icon indicating copy to clipboard operation
OpenTl.ClientApi copied to clipboard

Can't create a new client

Open ZioZen opened this issue 4 years ago • 3 comments

Hi, I'm trying to create an app that use this api, but when i try to create a new client the program crash and tell me "System.ArgumentNullException: 'Value cannot be null. Parameter name: path1"

This is the code that I used:

            var settings = new FactorySettings
            {
                AppHash = "0f5b4xxxxxxxxxxxxxxxca4d4",
                AppId = 1xxxxxx8,
                ServerAddress = "149.154.167.40",
                ServerPublicKey = @"-----BEGIN RSA PUBLIC KEY-----
.
.
.
-----END PUBLIC KEY-----",
                ServerPort = 443,
                SessionTag = "session", // by defaut
                Properties = new ApplicationProperties
                {
                    AppVersion = "1.0.0", // You can leave as in the example
                    DeviceModel = "PC", // You can leave as in the example
                    LangCode = "en", // You can leave as in the example
                    LangPack = "tdesktop", // You can leave as in the example
                    SystemLangCode = "en", // You can leave as in the example
                    SystemVersion = "Win 10 Pro" // You can leave as in the example
                }
            };
            // Create the client
            var clientApi = await ClientFactory.BuildClientAsync(settings).ConfigureAwait(true);

I don't know from where this path1 came from, and how to fix it.

ZioZen avatar Sep 01 '20 11:09 ZioZen

I have the exact same code and have no problems. Do you have any inner exceptions?

KoalaBear84 avatar Sep 01 '20 11:09 KoalaBear84

No, I don't have any inner exceprion. I put the code inside a try-cath and this is the error that I have:

System.ArgumentNullException: Value cannot be null. Parameter name: path1 at System.IO.Path.Combine (System.String path1, System.String path2) [0x00003] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/corlib/System.IO/Path.cs:102 at OpenTl.ClientApi.Settings.FileSessionStore.SetSessionTag (System.String sessionTag) [0x00024] in <7438c12f34b74c58b06c1f081256b9c1>:0 at OpenTl.ClientApi.ClientFactory.FillSettings (Castle.Windsor.IWindsorContainer container, OpenTl.ClientApi.IFactorySettings factorySettings) [0x0011e] in <7438c12f34b74c58b06c1f081256b9c1>:0 at OpenTl.ClientApi.ClientFactory.BuildClientAsync (OpenTl.ClientApi.IFactorySettings factorySettings) [0x0004c] in <7438c12f34b74c58b06c1f081256b9c1>:0 at InventoryBotMinerApp.MainPage.StartConnection (System.Object sender, System.EventArgs args) [0x000dc] in D:\Programmazione\InventoryBotMinerApp\InventoryBotMinerApp\MainPage.xaml.cs:174 }

Is possible that the problem is the ServerPublicKey? I put the entire key, and it give me the error; I try with only the RSA PUBLIC KEY, and I have the same problem...

ZioZen avatar Sep 01 '20 13:09 ZioZen

I know that part is very strict. I have it exactly like this:

                string rsaPublicKey = @"-----BEGIN RSA PUBLIC KEY-----
MIIBC****
ly****
aq***
EfD****
8j****
Slm****
-----END RSA PUBLIC KEY-----";

KoalaBear84 avatar Sep 02 '20 06:09 KoalaBear84