Skip to content

fix(management): 自集控拉取组件数据时无法解析颜色值#1703

Merged
HelloWRC merged 1 commit into
ClassIsland:masterfrom
IsHPDuwu:fix/mang.decode.comp.color
Mar 15, 2026
Merged

fix(management): 自集控拉取组件数据时无法解析颜色值#1703
HelloWRC merged 1 commit into
ClassIsland:masterfrom
IsHPDuwu:fix/mang.decode.comp.color

Conversation

@IsHPDuwu

Copy link
Copy Markdown
Contributor

这个 Pull Request 做了什么?

在 从集控中通过 WebRequestHelper 获取组件信息中的 ForegroundColor 时 加上 color(str) -> Avalonia.Media.Color 转换器

问题表现

2026/03/13 23:05:23 | warn | ClassIsland.Helpers.WebRequestHelper | Json GET 请求失败(第 2 次重试)http://localhost:8000/api/v1/objects/temp-class/components.json
System.Text.Json.JsonException: The JSON value could not be converted to Avalonia.Media.Color. Path: $.Lines[0].Children[0].ForegroundColor | LineNumber: 0 | BytePositionInLine: 689.
   at System.Text.Json.ThrowHelper.ThrowJsonException_DeserializeUnableToConvertValue(Type propertyType)
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
   at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
   at System.Text.Json.Serialization.JsonCollectionConverter`2.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, TCollection& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
   at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
   at System.Text.Json.Serialization.JsonCollectionConverter`2.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, TCollection& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
   at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, T& value, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.Deserialize(Utf8JsonReader& reader, ReadStack& state)
   at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 utf8Json, JsonTypeInfo`1 jsonTypeInfo, Nullable`1 actualByteCount)
   at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 json, JsonTypeInfo`1 jsonTypeInfo)    
   at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options)
   at ClassIsland.Helpers.WebRequestHelper.GetJson[T](Uri uri, Int32 retries, Nullable`1 cancellationToken, Boolean verifySign, String publicKey) in D:\Documents\GitHub\ClassIsland\ClassIsland\Helpers\WebRequestHelper.cs:line 67

检查清单

  • 我已经在本地测试过这个 PR,确保欲实现的功能或修复的问题能正常工作。

@IsHPDuwu IsHPDuwu requested review from a team and HelloWRC as code owners March 13, 2026 15:43
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@IsHPDuwu IsHPDuwu changed the title fix: 自集控拉取组件数据时无法解析颜色值 fix(management): 自集控拉取组件数据时无法解析颜色值 Mar 14, 2026
@HelloWRC HelloWRC merged commit 9438ba8 into ClassIsland:master Mar 15, 2026
2 checks passed
@HelloWRC

Copy link
Copy Markdown
Member

感谢您的贡献🤝

昔涟 爱

Koharu-Mizuki pushed a commit to Koharu-Mizuki/ClassIsland-RB that referenced this pull request Jun 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants