Error

Anyone know why this is happening? im a bit lost here. "System.NullReferenceException: 'The object reference is not set to an instance of an object.'" https://gyazo.com/53783b0f627a112e1ab2e852926826af
Gyazo
Gyazo
28 Replies
Thinker
Thinker2y ago
addressInfo or ChainStats is null So it appears that there's something wrong with the JSON deserialization Can you show the structure of AddressInfo? And what does the JSON string look like?
slotsclassic
slotsclassic2y ago
wdym json string look like?
public class AddressInfo
{
public string Address { get; set; }
public ChainStats ChainStats { get; set; }
}
public class AddressInfo
{
public string Address { get; set; }
public ChainStats ChainStats { get; set; }
}
Denis
Denis2y ago
You are deserializing a string. It's value is in the format of json . Copy the value of the string you are deserializing And paste it here
x0rld
x0rld2y ago
the json should look like that in json variable
{
"address": ""
"ChainStats": {..}
}
{
"address": ""
"ChainStats": {..}
}
Denis
Denis2y ago
The value of the json variable at line 87 to be specific
slotsclassic
slotsclassic2y ago
uhm weird shit i didnt touch anything in the code, but it works now how
x0rld
x0rld2y ago
catderp
slotsclassic
slotsclassic2y ago
slotsclassic
slotsclassic2y ago
tf why it just work out of thin air
Denis
Denis2y ago
Connection issue?
slotsclassic
slotsclassic2y ago
all i added since then was a "with balance capture" put into my if(balance > 0) withBal++.ToString();
x0rld
x0rld2y ago
don't do a ++ and another operation ( ToString) at same time it's a really make it super harder to read
Thinker
Thinker2y ago
Could be that, since you're calling an external API, that the API just happened to return null or unauthorized or something at that point
slotsclassic
slotsclassic2y ago
thats always how i capture int values, how would you be doing it? so an error from the API and not my code
Thinker
Thinker2y ago
perhaps
x0rld
x0rld2y ago
you want to have the string before or after adding +1 to your variable ?
Thinker
Thinker2y ago
You should probably do a null check after the AddressInfo addressInfo = ... line.
x0rld
x0rld2y ago
I just say do that instead of one line it it's much easier to read
withBal++;
withBal.ToString();
withBal++;
withBal.ToString();
Denis
Denis2y ago
Less lines != Good code
x0rld
x0rld2y ago
btw you could use directly this method to deserialize instead of getting string, then read it, then deserialize it https://learn.microsoft.com/en-us/dotnet/api/system.net.http.json.httpclientjsonextensions.getfromjsonasync?view=net-7.0
slotsclassic
slotsclassic2y ago
well, shits fixed now. Now i just have to add proxy support so i wont get timeout
Buddy
Buddy2y ago
What are you making?
slotsclassic
slotsclassic2y ago
tbh project is useless, but a good practise thing its just gens a mnemonic and checks for the balance through an API
Buddy
Buddy2y ago
eh, ok lol
slotsclassic
slotsclassic2y ago
but the chance of actually finding a lost crypto wallet with it is 0.00000000000000000000000000000000000000684%
Buddy
Buddy2y ago
So what does it actually achieve?
slotsclassic
slotsclassic2y ago
My practise skills with web requests only tbh nothing else practise using loops
Scratch
Scratch2y ago
!ban @Degenerate developing hacking tools
Want results from more Discord servers?
Add your server
More Posts