crc-org / tray-windows

CodeReady Containers tray for windows
Apache License 2.0
2 stars 4 forks source link

Exception thrown if `pull-secret-file` config key is set #126

Closed anjannath closed 2 years ago

anjannath commented 3 years ago

If the pull-secret file set, then clicking on Start from the tray throws an exception.

image

Exception details

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.Text.Json.JsonReaderException: 'p' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0.
   at System.Text.Json.Utf8JsonReader.ConsumeValue(Byte marker)
   at System.Text.Json.Utf8JsonReader.ReadFirstToken(Byte first)
   at System.Text.Json.Utf8JsonReader.ReadSingleSegment()
   at System.Text.Json.Utf8JsonReader.Read()
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)

************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4400.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
crc-tray
    Assembly Version: 0.10.0.0
    Win32 Version: 0.10.0.0
    CodeBase: file:///C:/Program%20Files/CodeReady%20Containers/crc-tray.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4400.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4360.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4390.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4190.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4390.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4084.0 built by: NET48REL1
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Text.Json
    Assembly Version: 5.0.0.1
    Win32 Version: 0.10.0.0
    CodeBase: file:///C:/Program%20Files/CodeReady%20Containers/crc-tray.exe
----------------------------------------
System.Net.Http
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4084.0 built by: NET48REL1
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Net.Http/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Net.Http.dll
----------------------------------------
HttpOverStream.NamedPipe
    Assembly Version: 1.0.0.0
    Win32 Version: 0.10.0.0
    CodeBase: file:///C:/Program%20Files/CodeReady%20Containers/crc-tray.exe
----------------------------------------
HttpOverStream
    Assembly Version: 1.0.0.0
    Win32 Version: 0.10.0.0
    CodeBase: file:///C:/Program%20Files/CodeReady%20Containers/crc-tray.exe
----------------------------------------
System.Threading.Tasks.Extensions
    Assembly Version: 4.2.0.1
    Win32 Version: 0.10.0.0
    CodeBase: file:///C:/Program%20Files/CodeReady%20Containers/crc-tray.exe
----------------------------------------
netstandard
    Assembly Version: 2.0.0.0
    Win32 Version: 4.8.4084.0
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/netstandard/v4.0_2.0.0.0__cc7b13ffcd2ddd51/netstandard.dll
----------------------------------------
HttpOverStream.Client
    Assembly Version: 1.0.0.0
    Win32 Version: 0.10.0.0
    CodeBase: file:///C:/Program%20Files/CodeReady%20Containers/crc-tray.exe
----------------------------------------
System.ValueTuple
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4084.0
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.ValueTuple/v4.0_4.0.0.0__cc7b13ffcd2ddd51/System.ValueTuple.dll
----------------------------------------
System.Runtime.CompilerServices.Unsafe
    Assembly Version: 5.0.0.0
    Win32 Version: 0.10.0.0
    CodeBase: file:///C:/Program%20Files/CodeReady%20Containers/crc-tray.exe
----------------------------------------
System.Memory
    Assembly Version: 4.0.1.1
    Win32 Version: 0.10.0.0
    CodeBase: file:///C:/Program%20Files/CodeReady%20Containers/crc-tray.exe
----------------------------------------
System.Buffers
    Assembly Version: 4.0.3.0
    Win32 Version: 0.10.0.0
    CodeBase: file:///C:/Program%20Files/CodeReady%20Containers/crc-tray.exe
----------------------------------------
System.Text.Encodings.Web
    Assembly Version: 5.0.0.1
    Win32 Version: 0.10.0.0
    CodeBase: file:///C:/Program%20Files/CodeReady%20Containers/crc-tray.exe
----------------------------------------
System.Numerics.Vectors
    Assembly Version: 4.1.4.0
    Win32 Version: 0.10.0.0
    CodeBase: file:///C:/Program%20Files/CodeReady%20Containers/crc-tray.exe
----------------------------------------
Microsoft.Bcl.AsyncInterfaces
    Assembly Version: 5.0.0.0
    Win32 Version: 0.10.0.0
    CodeBase: file:///C:/Program%20Files/CodeReady%20Containers/crc-tray.exe
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
gbraad commented 3 years ago

JSON deserializer issue.

gbraad commented 3 years ago

I can not reproduce this with the current tray and a previous version of the backend. (avoiding config calls).

On start we use the /api/pull-secret to determine if this is set. This is not a JSON response.

gbraad commented 3 years ago

image

gbraad commented 3 years ago

We specifically expect a 200 OK with an empty result: https://github.com/code-ready/tray-windows/blob/482f4dafec482add25cbdbd92567521426807745/Communication/DaemonCommander.cs#L85-L109

And this got changed here: https://github.com/code-ready/crc/commit/4c786d0865e5d6f1fa3a5492b49a024295422e2a#diff-bcb95a56a8b0d6310d991246364f360be183560450d8b59a318c317cbaf23888R62 to return 200 OK with a message: pull secret exists. This will fail the JSON deserialization, as the message is NOT empty anymore.