Skip to content

Commit

Permalink
fix: Make sure if a processor is reported more than once the client h…
Browse files Browse the repository at this point in the history
…andles it properly
  • Loading branch information
dr1rrb committed Nov 8, 2024
1 parent be56be4 commit 1071846
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Uno.UI.RemoteControl/RemoteControlClient.Status.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,19 @@ public void ReportServerProcessors(ProcessorsDiscoveryResponse response)

static IEnumerable<MissingProcessor> GetMissingServerProcessors(ImmutableHashSet<ProcessorInfo> requiredProcessors, ProcessorsDiscoveryResponse response)
{
var loaded = response.Processors.ToDictionary(p => p.Type, StringComparer.OrdinalIgnoreCase);
var loaded = response
.Processors
.GroupBy(p => p.Type, StringComparer.OrdinalIgnoreCase)
// If a processors is being loaded multiple times, we prefer to keep the result that has no error.
.Select(g => g
.OrderBy(p => p switch
{
{ LoadError: not null } => 0,
{ IsLoaded: false } => 1,
_ => 2
})
.Last())
.ToDictionary(p => p.Type, StringComparer.OrdinalIgnoreCase);
foreach (var required in requiredProcessors)
{
if (!loaded.TryGetValue(required.TypeFullName, out var actual))
Expand Down

0 comments on commit 1071846

Please sign in to comment.