Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug Report:Error parsing JSON. JSON was null. #20

Closed
1 task done
CMTriX opened this issue Oct 23, 2023 · 15 comments
Closed
1 task done

Bug Report:Error parsing JSON. JSON was null. #20

CMTriX opened this issue Oct 23, 2023 · 15 comments
Assignees
Labels
bug Something isn't working

Comments

@CMTriX
Copy link
Collaborator

CMTriX commented Oct 23, 2023

Is there an existing issue for this?

  • I have searched the existing issues (both open and closed).

What happened or didn't happen?

Error parsing JSON. JSON was null.
System.ArgumentNullException: Value cannot be null. (Parameter 'json')
at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options)
at GetMyIP.Helpers.IpHelpers.<>c__DisplayClass5_0.b__0()

Steps To Reproduce

after installation with checkbox run after install checked

Version

0.9.0

Windows Version

(all updates) Microsoft Windows 10.0.22621

Relevant log output

Error parsing JSON. JSON was null.
System.ArgumentNullException: Value cannot be null. (Parameter 'json')
   at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options)
   at GetMyIP.Helpers.IpHelpers.<>c__DisplayClass5_0.<ProcessIPInfo>b__0()

Anything else?

No response

@CMTriX CMTriX added bug Something isn't working needs triage labels Oct 23, 2023
@Timthreetwelve
Copy link
Owner

That didn't take long. I'll dig into it.

@Timthreetwelve
Copy link
Owner

@CMTriX, Were there any error messages prior to the "JSON was null" message?

@Timthreetwelve
Copy link
Owner

Also, what happens if you go to
http://ip-api.com/json/?fields=status,message,country,continent,regionName,city,zip,lat,lon,timezone,offset,isp,asname,as,query
in a browser?

@Timthreetwelve
Copy link
Owner

I published 0.9.1 which has additional logging to help diagnose the null JSON error. If you have a chance, install that release and when the issue reoccurs attach the log. Mask or omit any details you feel necessary.

Thanks,
Tim

@CMTriX
Copy link
Collaborator Author

CMTriX commented Oct 24, 2023

http://ip-api.com/json/?fields=status,message,country,continent,regionName,city,zip,lat,lon,timezone,offset,isp,asname,as,query

status "fail"
message "SSL unavailable for this…ps://members.ip-api.com/"

@CMTriX
Copy link
Collaborator Author

CMTriX commented Oct 24, 2023

I published 0.9.1 which has additional logging to help diagnose the null JSON error. If you have a chance, install that release and when the issue reoccurs attach the log. Mask or omit any details you feel necessary.

Thanks, Tim

When error pops up again, i will send the log. Thank you!

@Timthreetwelve
Copy link
Owner

status "fail"
message "SSL unavailable for this…ps://members.ip-api.com/"

This indicates a problem connecting to ip-api.com. I don't have a clue where "members" in the URL comes from. This behavior could certainly be causing the Json to be null.

I'm super busy with real life obligations today. I may not be able to look any further until tomorrow.

Tim

@CMTriX
Copy link
Collaborator Author

CMTriX commented Oct 24, 2023

SSL unavailable for this endpoint, order a key at https://members.ip-api.com/

@Timthreetwelve
Copy link
Owner

Here's the problem I'm facing, there are several providers that will supply public IP information for free. However, most of them want the user to sign up for a key. Of the few that don't require a key, ip-api.com offered the most details. Now it appears that somehow you are being redirected to the URL that requires a key.

I won't ask users of GetMyIP to get a key to be able to use the app. That would simply be a nonstarter for many.

I want GetMyIP to work, without errors, for everyone that wants to use it. The way I see it I have 3 choices.

  1. Change from ip-api.com to another provider that offers less information. Basically, just the public IP address. I have a feeling that this is all most users care about.
  2. Update the app to offer a choice of providers and tell users to find the one that works for them. This would be a lot of work, but I'm willing to do it.
  3. Leave everything as it is.

What would you do if you were in my shoes?

Tim

@CMTriX
Copy link
Collaborator Author

CMTriX commented Oct 25, 2023

maybey just wait until more reports are coming.
Or! If JSON error, try several times to get the info before error popup. And suggest user for reporting the error, and the log file.
If you have enough reports, you can rebuild the tool with the choic of provider.

After my JSON error, i refreshed and then it worked.

@Timthreetwelve
Copy link
Owner

After my JSON error, i refreshed and then it worked.

@CMTriX, thanks for your ideas. Your last comment started me thinking...

In the log file, there is a line like "Discovering external IP information took ###.## ms". Would you collect a few of those lines, for both when the app fails and when it works. Label each with fail or success, then paste them into the issue.

Thanks,
Tim

@Timthreetwelve
Copy link
Owner

@CMTriX Disregard my last message. I think I have the problem isolated and corrected. Long day, I'll pick this up again tomorrow.

Tim

@CMTriX
Copy link
Collaborator Author

CMTriX commented Oct 26, 2023

Started program many times now, but the error is not showing ... grr... ;)
Close ticket. If the error comes back, i reopen / open ticket.

Anything else:
Give the dog a cookie!

@CMTriX
Copy link
Collaborator Author

CMTriX commented Oct 27, 2023

2023/10/27 09:40:09.70 INFO GetMyIP (Get My IP) 0.9.1.0 is starting up
2023/10/27 09:40:09.71 INFO GetMyIP Copyright © 2023 Tim Kennedy
2023/10/27 09:40:09.71 DEBUG GetMyIP Build date: 10/24/2023 02:37:36 (UTC)
2023/10/27 09:40:09.71 DEBUG GetMyIP Commit ID: 154e1fa
2023/10/27 09:40:09.71 DEBUG GetMyIP was started from C:\Users\office\AppData\Local\Programs\T_K\Get My IP\GetMyIP.exe
2023/10/27 09:40:09.75 DEBUG Operating System version: Microsoft Windows 10.0.22621
2023/10/27 09:40:09.75 DEBUG .NET version: 6.0.24
2023/10/27 09:40:09.75 DEBUG Startup culture: nl-NL UI: nl-NL
2023/10/27 09:40:09.75 DEBUG Current culture: en-US UI: en-US
2023/10/27 09:40:09.75 DEBUG 189 strings loaded from Languages/Strings.en-US.xaml
2023/10/27 09:40:09.93 DEBUG Starting discovery of internal IP information.
2023/10/27 09:40:09.93 DEBUG Starting discovery of external IP information.
2023/10/27 09:40:10.03 DEBUG Internal IPv4 Address is 198.18.64.17
2023/10/27 09:40:10.03 DEBUG Internal IPv4 Address is 192.168.2.5
2023/10/27 09:40:10.03 DEBUG Internal IPv4 Address is 192.168.27.1
2023/10/27 09:40:10.03 DEBUG Internal IPv4 Address is 192.168.153.1
2023/10/27 09:40:10.03 DEBUG Internal IPv6 Address is fe80::3ad%26
2023/10/27 09:40:10.03 DEBUG Internal IPv6 Address is fe80::a5a:c6b1:4962:5ea3%12
2023/10/27 09:40:10.03 DEBUG Internal IPv6 Address is 2a02:a450:49e1:1:a59c:d0ed:94a2:dad2
2023/10/27 09:40:10.03 DEBUG Internal IPv6 Address is 2a02:a450:49e1:1:d8b2:ba7e:ac60:2cf7
2023/10/27 09:40:10.03 DEBUG Internal IPv6 Address is fe80::7a9c:b460:3ece:f93%15
2023/10/27 09:40:10.03 DEBUG Internal IPv6 Address is fe80::a087:3126:4af1:4bd9%3
2023/10/27 09:40:10.03 DEBUG Internal IPv6 Address is fc00:fed0:0:beef::3ad
2023/10/27 09:40:10.03 DEBUG Discovering internal addresses took 45.99 ms
2023/10/27 09:40:10.22 ERROR JSON was null. Check for previous error messages.
2023/10/27 09:40:10.28 DEBUG Received status code: OK - OK
2023/10/27 09:40:10.28 DEBUG Discovering external IP information took 420.66 ms
2023/10/27 09:41:07.39 DEBUG Opening C:\Users\office\AppData\Local\Temp\T_K\GetMyIP.20231027.log in default application

@Timthreetwelve
Copy link
Owner

I believe that the error that happened in this case was the parsing of the Json that's supposed to contain the external IP information started before it should have. I changed how this works and hopefully it doesn't happen again. If it does, please let me know.

Tim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants