rfvgyhn / min-ed-launcher

Minimal Elite Dangerous Launcher
MIT License
267 stars 10 forks source link

Json parsing error when launching with a pre-loaded EDMC #21

Closed FancyBanana closed 3 years ago

FancyBanana commented 3 years ago

I've edited settings.json file to auto-launch ED Market Connector but when I try to launch the game the application crashes.

Platform: Windows 10, Steam.

Here's my settings.json (Edit, made a typo) :

{
    "apiUri": "https://api.zaonce.net",
    "watchForCrashes": false,
    "language": null,
    "restart": {
        "enabled": false,
        "shutdownTimeout": 3
    },
    "processes": [
        "fileName": "C:\\Program Files (x86)\\EDMarketConnector\\EDMarketConnector.exe"
    ]
}

And here's the log of the crash:

2021-04-23 10:53:09.838 +02:00 [DBG] Args: [|"D:\SteamLibrary\steamapps\common\Elite Dangerous\EDLaunch.exe"; "/Steam";
  "/novr"; "/autorun"; "/autoquit"; "/EDH"|]
2021-04-23 10:53:09.956 +02:00 [DBG] Reading settings from 'C:\Users\victo\AppData\Local\min-ed-launcher\settings.json'
2021-04-23 10:53:10.058 +02:00 [ERR] Unhandled exception: System.FormatException: Error_JSONParseError
 ---> System.Text.Json.JsonReaderException: FoundInvalidCharacter, : LineNumber: 9 | BytePositionInLine: 12.
   at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan`1 bytes)
   at System.Text.Json.Utf8JsonReader.Con...CommentsAreSkipped(Byte marker)
   at System.Text.Json.Utf8JsonReader.ConsumeNextToken(Byte marker)
   at System.Text.Json.Utf8JsonReader.ConsumeNextTokenOrRollback(Byte marker)
   at System.Text.Json.Utf8JsonReader.ReadSingleSegment()
   at System.Text.Json.Utf8JsonReader.Read()
   at System.Text.Json.JsonDocument.Parse(ReadOnlySpan`1 utf8JsonSpan, JsonReaderOptions readerOptions, MetadataDb& database, StackRowStack& stack)
   at System.Text.Json.JsonDocument.Parse(ReadOnlyMemory`1 utf8Json, JsonReaderOptions readerOptions, Byte[] extraRentedBytes)
   at System.Text.Json.JsonDocument.Parse(ReadOnlyMemory`1 json, JsonDocumentOptions options)
   at System.Text.Json.JsonDocument.Parse(String json, JsonDocumentOptions options)
   at Microsoft.Extensions.Configuration.Json.JsonConfigurationFileParser.ParseStream(Stream input)
   at Microsoft.Extensions.Configuration.Json.JsonConfigurationFileParser.Parse(Stream input)
   at Microsoft.Extensions.Configuration.Json.JsonConfigurationProvider.Load(Stream stream)
   Exception_EndOfInnerExceptionStack
   at Microsoft.Extensions.Configuration.Json.JsonConfigurationProvider.Load(Stream stream)
   at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load(Boolean reload)
--- End of stack trace from previous location ---
   at Microsoft.Extensions.Configuration.FileConfigurationProvider.HandleException(ExceptionDispatchInfo info)
   at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load(Boolean reload)
   at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load()
   at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList`1 providers)
   at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
   at MinEdLauncher.Settings.parseConfig(String fileName)
   at MinEdLauncher.Program.getSettings(String[] args)
   at MinEdLauncher.Program.main@36-2.Invoke(Unit _arg1)
   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvokeNoHijackCheck[a,b](AsyncActivation`1 ctxt, FSharpFunc`2 userCode, b result1)
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction)
rfvgyhn commented 3 years ago

Looks like a duplicate key (filename twice). Try the following.


{
    "apiUri": "https://api.zaonce.net",
    "watchForCrashes": false,
    "language": null,
    "restart": {
        "enabled": false,
        "shutdownTimeout": 3
    },
    "processes": [
        "fileName": "C:\\Program Files (x86)\\EDMarketConnector\\EDMarketConnector.exe"
    ]
}
FancyBanana commented 3 years ago

@Rfvgyhn Sry, that was me making a mistake while copy-pasting into issue. The config I used is the same you posted:

{
    "apiUri": "https://api.zaonce.net",
    "watchForCrashes": false,
    "language": null,
    "restart": {
        "enabled": false,
        "shutdownTimeout": 3
    },
    "processes": [
        "fileName": "C:\\Program Files (x86)\\EDMarketConnector\\EDMarketConnector.exe"
    ]
}

and it's the same error:

2021-04-24 17:47:56.600 +02:00 [DBG] Args: [|"D:\SteamLibrary\steamapps\common\Elite Dangerous\EDLaunch.exe"; "/Steam";
  "/novr"; "/autorun"; "/autoquit"; "/EDH"|]
2021-04-24 17:47:56.710 +02:00 [DBG] Reading settings from 'C:\Users\victo\AppData\Local\min-ed-launcher\settings.json'
2021-04-24 17:47:56.800 +02:00 [ERR] Unhandled exception: System.FormatException: Error_JSONParseError
 ---> System.Text.Json.JsonReaderException: FoundInvalidCharacter, : LineNumber: 9 | BytePositionInLine: 12.
   at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan`1 bytes)
   at System.Text.Json.Utf8JsonReader.Con...CommentsAreSkipped(Byte marker)
   at System.Text.Json.Utf8JsonReader.ConsumeNextToken(Byte marker)
   at System.Text.Json.Utf8JsonReader.ConsumeNextTokenOrRollback(Byte marker)
   at System.Text.Json.Utf8JsonReader.ReadSingleSegment()
   at System.Text.Json.Utf8JsonReader.Read()
   at System.Text.Json.JsonDocument.Parse(ReadOnlySpan`1 utf8JsonSpan, JsonReaderOptions readerOptions, MetadataDb& database, StackRowStack& stack)
   at System.Text.Json.JsonDocument.Parse(ReadOnlyMemory`1 utf8Json, JsonReaderOptions readerOptions, Byte[] extraRentedBytes)
   at System.Text.Json.JsonDocument.Parse(ReadOnlyMemory`1 json, JsonDocumentOptions options)
   at System.Text.Json.JsonDocument.Parse(String json, JsonDocumentOptions options)
   at Microsoft.Extensions.Configuration.Json.JsonConfigurationFileParser.ParseStream(Stream input)
   at Microsoft.Extensions.Configuration.Json.JsonConfigurationFileParser.Parse(Stream input)
   at Microsoft.Extensions.Configuration.Json.JsonConfigurationProvider.Load(Stream stream)
   Exception_EndOfInnerExceptionStack
   at Microsoft.Extensions.Configuration.Json.JsonConfigurationProvider.Load(Stream stream)
   at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load(Boolean reload)
--- End of stack trace from previous location ---
   at Microsoft.Extensions.Configuration.FileConfigurationProvider.HandleException(ExceptionDispatchInfo info)
   at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load(Boolean reload)
   at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load()
   at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList`1 providers)
   at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
   at MinEdLauncher.Settings.parseConfig(String fileName)
   at MinEdLauncher.Program.getSettings(String[] args)
   at MinEdLauncher.Program.main@36-2.Invoke(Unit _arg1)
   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvokeNoHijackCheck[a,b](AsyncActivation`1 ctxt, FSharpFunc`2 userCode, b result1)
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction)
rfvgyhn commented 3 years ago

Whoops, I missed the missing curly braces. The processes array contains objects to allow you to specify command line args to your executable.

{
    "apiUri": "https://api.zaonce.net",
    "watchForCrashes": false,
    "language": null,
    "restart": {
        "enabled": false,
        "shutdownTimeout": 3
    },
    "processes": [
        {
            "fileName": "C:\\Program Files (x86)\\EDMarketConnector\\EDMarketConnector.exe"
        }
    ]
}
FancyBanana commented 3 years ago

Pretty stupid of me, considering I deal with json on daily basis... Thanks for helping out. You should probably add this as a troubleshooting step in your readme for dumdums like me.