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

Unhandled exception when trying to fill the library #29

Closed
GaMeRaM opened this issue Nov 8, 2024 · 14 comments
Closed

Unhandled exception when trying to fill the library #29

GaMeRaM opened this issue Nov 8, 2024 · 14 comments
Labels
bug Something isn't working

Comments

@GaMeRaM
Copy link
Contributor

GaMeRaM commented Nov 8, 2024

I did run it as administrator.
It doesn't seem to be based on the specific game.
When i moved Abiotic Factor out of the folder - it failed on the next game that had exe in its folder
image

@JMTK
Copy link
Owner

JMTK commented Nov 9, 2024

**GaMeRaM ** commented Nov 8, 2024

I just pushed a new version, 1.8.2, can you try it out?
https://github.com/JMTK/SunshineGameFinder/releases/tag/1.8.2

@GaMeRaM
Copy link
Contributor Author

GaMeRaM commented Nov 11, 2024

I appreciate the fast fix!

Seems like there is another problem. Sunshine on windows wraps booleans and numbers in quotes. And it breaks json parser in SunshineGameFinder:
image
image
When i convert them from strings to the actual types GameFinder works correctly, but resulting config seems to break the Sunshine. No games are shown in Moonlight on android

There is also a difference that Sunshine writes empty parameters like output as empty strings but GameFinder writes them as null

Also there is a note in Sunshine UI that if path to executable contains spaces - you should wrap the path in quotes. GameFinder currently doesnt do that (and kinda breaks previous games. It now added unicode characters instead of escaped quotes)
image

@JMTK
Copy link
Owner

JMTK commented Nov 11, 2024

I appreciate the fast fix!

Seems like there is another problem. Sunshine on windows wraps booleans and numbers in quotes. And it breaks json parser in SunshineGameFinder: image image When i convert them from strings to the actual types GameFinder works correctly, but resulting config seems to break the Sunshine. No games are shown in Moonlight on android

There is also a difference that Sunshine writes empty parameters like output as empty strings but GameFinder writes them as null

Also there is a note in Sunshine UI that if path to executable contains spaces - you should wrap the path in quotes. GameFinder currently doesnt do that (and kinda breaks previous games. It now added unicode characters instead of escaped quotes) image

Would you mind sharing your apps.json so I can use it for testing? It seems your configuration varies wildly from what I am testing against so I wanna make sure I meet all the use cases

@JMTK
Copy link
Owner

JMTK commented Nov 11, 2024

Hi @GaMeRaM I was able to reproduce your issue, would you kindly try 1.9.2? https://github.com/JMTK/SunshineGameFinder/releases/tag/1.9.2

If that's still not working, would you be able to share your apps.json so I can further troubleshoot?

Thank you!

@JMTK JMTK added the bug Something isn't working label Nov 12, 2024
@GaMeRaM
Copy link
Contributor Author

GaMeRaM commented Nov 12, 2024

Hi @GaMeRaM I was able to reproduce your issue, would you kindly try 1.9.2? https://github.com/JMTK/SunshineGameFinder/releases/tag/1.9.2

If that's still not working, would you be able to share your apps.json so I can further troubleshoot?

Thank you!

I'm sorry, but seems like this release doesnt contain a compiled binary

Added three files:

  1. originally generated by sunshine and one game added using sunshine web ui: 1_apps_sunshine_generated.json
  2. original file fixed by hand to make it work with gamefinder: 2_apps_sunshine_compatible.json
  3. apps.json generated by GameFinder based on File 2: 3_apps_gamefinder.json

@JMTK
Copy link
Owner

JMTK commented Nov 12, 2024

Hi @GaMeRaM I was able to reproduce your issue, would you kindly try 1.9.2? https://github.com/JMTK/SunshineGameFinder/releases/tag/1.9.2
If that's still not working, would you be able to share your apps.json so I can further troubleshoot?
Thank you!

I'm sorry, but seems like this release doesnt contain a compiled binary

Added three files:

  1. originally generated by sunshine and one game added using sunshine web ui: 1_apps_sunshine_generated.json
  2. original file fixed by hand to make it work with gamefinder: 2_apps_sunshine_compatible.json
  3. apps.json generated by GameFinder based on File 2: 3_apps_gamefinder.json

Weird, sorry about that. Seems like the upload originally failed. Should be good now. I'll test out your files in the meantime! Thank you

@GaMeRaM
Copy link
Contributor Author

GaMeRaM commented Nov 12, 2024

Tried it with file 1
image
Seems like it doesnt like empty env key in apps.json (which comes empty default with sunshine)

@JMTK
Copy link
Owner

JMTK commented Nov 12, 2024

Tried it with file 1

image

Seems like it doesnt like empty env key in apps.json (which comes empty default with sunshine)

Interesting, mine is also empty but I'm not seeing that issue. I'll do some more testing!

@GaMeRaM
Copy link
Contributor Author

GaMeRaM commented Nov 12, 2024

Tried to fix it myself and it seems to be working correctly (however it may be wrong in Env departament)
https://github.com/GaMeRaM/SunshineGameFinder/tree/json-serialiser-fix
(Sorry if code looks jank. I'm not a C# programmer, so there is some AI stuff that may be weird)

Also found a bug. GameFinder will remove any game that starts through 'steam://...' cmd if removeUninstalled is true

@JMTK
Copy link
Owner

JMTK commented Nov 12, 2024

Tried to fix it myself and it seems to be working correctly (however it may be wrong in Env departament) https://github.com/GaMeRaM/SunshineGameFinder/tree/json-serialiser-fix (Sorry if code looks jank. I'm not a C# programmer, so there is some AI stuff that may be weird)

Also found a bug. GameFinder will remove any game that starts through 'steam://...' cmd if removeUninstalled is true

Awesome I think your code looks good! Thanks for looking into it. Feel free to go ahead and open a PR and list all the improvements I'd be happy to merge it in!

@GaMeRaM
Copy link
Contributor Author

GaMeRaM commented Nov 12, 2024

#33

@strazto
Copy link

strazto commented Nov 13, 2024

Sounds like the solution is in the pipeline but I get a similar issue with 1.9.2 , related to the env key it seems:

Unhandled exception: Newtonsoft.Json.JsonSerializationException: Unable to find a constructor to use for type SunshineGameFinder.SunshineConfig. A class should either have a default constructor, one constructor with arguments or a constructor marked with the JsonConstructor attribute. Path 'env', line 2, position 10.
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateNewObject(JsonReader, JsonObjectContract, JsonProperty , JsonProperty , String , Boolean& )
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader , Type, JsonContract, JsonProperty, JsonContainerContract, JsonProperty, Object)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader , Type, JsonContract, JsonProperty, JsonContainerContract, JsonProperty, Object)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader , Type, Boolean)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader , Type)
   at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader , Type)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String , Type, JsonSerializerSettings)
   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String , JsonSerializerSettings)
   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String )
   at Program.<>c__DisplayClass0_0.<<Main>$>b__0(String[] addlDirectories, String[] addlExeExclusionWords, String sunshineConfigLocation, Boolean forceUpdate, Boolean removeUninstalled)
   at System.CommandLine.Handler.<>c__DisplayClass6_0`5.<SetHandler>b__0(InvocationContext context)
   at System.CommandLine.Invocation.AnonymousCommandHandler.Invoke(InvocationContext)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass17_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass12_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass19_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__18_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__5_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass8_0.<<UseExceptionHandler>b__0>d.MoveNext()

@GaMeRaM
Copy link
Contributor Author

GaMeRaM commented Nov 13, 2024

Sounds like the solution is in the pipeline but I get a similar issue with 1.9.2 , related to the env key it seems:

Unhandled exception: Newtonsoft.Json.JsonSerializationException: Unable to find a constructor to use for type SunshineGameFinder.SunshineConfig. A class should either have a default constructor, one constructor with arguments or a constructor marked with the JsonConstructor attribute. Path 'env', line 2, position 10.
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateNewObject(JsonReader, JsonObjectContract, JsonProperty , JsonProperty , String , Boolean& )
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader , Type, JsonContract, JsonProperty, JsonContainerContract, JsonProperty, Object)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader , Type, JsonContract, JsonProperty, JsonContainerContract, JsonProperty, Object)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader , Type, Boolean)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader , Type)
   at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader , Type)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String , Type, JsonSerializerSettings)
   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String , JsonSerializerSettings)
   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String )
   at Program.<>c__DisplayClass0_0.<<Main>$>b__0(String[] addlDirectories, String[] addlExeExclusionWords, String sunshineConfigLocation, Boolean forceUpdate, Boolean removeUninstalled)
   at System.CommandLine.Handler.<>c__DisplayClass6_0`5.<SetHandler>b__0(InvocationContext context)
   at System.CommandLine.Invocation.AnonymousCommandHandler.Invoke(InvocationContext)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass17_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass12_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass19_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__18_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__5_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass8_0.<<UseExceptionHandler>b__0>d.MoveNext()

Can you please send your apps.json so I can test the updated code?

@JMTK
Copy link
Owner

JMTK commented Nov 19, 2024

Fixed in 1.10.0

@JMTK JMTK closed this as completed Nov 19, 2024
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

3 participants