elucidsoft / dotnet-stellar-sdk

Stellar API SDK for .NET 6.x
Apache License 2.0
116 stars 54 forks source link

Exception: accountId cannot be null #157

Closed ghost closed 5 years ago

ghost commented 5 years ago

Describe the bug Getting an exception when trying to get account, see here: var account = server.Accounts.Account(keyPair).Result;

This used to work and has only just stopped working. I have not updated/changed the version of the dotnet-stellar-sdk or changed the testnet-server.

Screenshots:

screenshot 2019-03-01 13 00 44 screenshot 2019-03-01 13 01 14

See full exception here: System.ArgumentNullException HResult=0x80004003 Message=accountId cannot be null Parameter name: accountId Source=stellar-dotnetstandard-sdk StackTrace: at stellar_dotnet_sdk.responses.Signer..ctor(String accountId, Nullable1 weight) in C:\Users\eric\Documents\GitHub\dotnetcore-stellar-sdk\stellar-dotnet-sdk\responses\AccountResponse.cs:line 147 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters(JsonReader reader, JsonObjectContract contract, JsonProperty containerProperty, ObjectConstructor1 creator, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateNewObject(JsonReader reader, JsonObjectContract objectContract, JsonProperty containerMember, JsonProperty containerProperty, String id, Boolean& createdFromNonDefaultCreator) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)

tylercmsft commented 5 years ago

Yes, seeing this error as well today - haven't changed my code in months. I just posted this over at stackexchange (https://stellar.stackexchange.com/questions/2260/anyone-else-seeing-an-error-with-stellar-dotnet-sdk-accountresponse-accountid) - it is happening in the constructor of the Signer object.

Kirbyrawr commented 5 years ago

Hi there, we changed things related to the keypair / addresses, can you try to put keyPair.AccountId ? Thanks PLEASE CHECK MY COMMENT BELOW

Kirbyrawr commented 5 years ago

Also you must update to the latest version because of 0.17.0 horizon changes.

ghost commented 5 years ago

Hi @Kirbyrawr and thanks for your reply. Unfortunately, I can't find an update to your SDK, currently have 2.0.6 installed. Please let me know what to do. Cheers

fracek commented 5 years ago

@nikolaimaximilian Have you tried installing version 2.1.0-beta4? You need to enable pre-release packages, version 2.0.6 is quite old.

elucidsoft commented 5 years ago

I'm going to release this as an official version 2.1 today and deploy the nuget package.

On Fri, Mar 1, 2019, 5:19 AM Francesco Ceccon notifications@github.com wrote:

@nikolaimaximilian https://github.com/nikolaimaximilian Have you tried installing version 2.1.0-beta4? You need to enable pre-release packages, version 2.0.6 is quite old.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/elucidsoft/dotnet-stellar-sdk/issues/157#issuecomment-468616295, or mute the thread https://github.com/notifications/unsubscribe-auth/AANRUGjzgQ-YplYhbXM50H76_G5SyqASks5vSP6RgaJpZM4bYHkl .

elucidsoft commented 5 years ago

This is already resolved in the source, if you need immediate resolution you can pull the source and build it manually.

nukec commented 5 years ago

AccountResponse still has KeyPair property, which at the moment returns back 0 after changes. Maybe remove that property fully or put obsolete, so people can fix their code.

elucidsoft commented 5 years ago

Absolutely, if you want to contribute and make this change I will accept your PR. This project only gets stronger by more community participation. Otherwise, other contributors can pick up this suggestion and commit it.