Repository: unoplatform/uno
File: src/Uno.UI.RemoteControl/HotReload/ClientHotReloadProcessor.Common.Status.cs (C#)

Code before:
			}
		}

		private Status BuildStatus()
		{
			var serverState = _serverState ?? (_localOperations.Any() ? HotReloadState.Ready /* no info */ : HotReloadState.Initializing);
			var localState = _localOperations.Any(op => op.Result is null) ? HotReloadState.Processing : HotReloadState.Ready;
			var globalState = _serverState switch
			{
				HotReloadState.Disabled => HotReloadState.Disabled,
				HotReloadState.Initializing => HotReloadState.Initializing,
				_ => (HotReloadState)Math.Max((int)serverState, (int)localState)
			};

			return new(globalState, (serverState, _serverOperations.Values.ToImmutableArray()), (localState, _localOperations));
		}
	}

	private void ReportDiagnostics(IImmutableList<string>? diagnostics)
	{
		if (
			diagnostics is { Count: > 0 }

			// We should only report this when server metadata
			// updates are enabled, other targets don't set diagnostics.
			&& _serverMetadataUpdatesEnabled)
		{
			_log.Error("The Hot Reload compilation failed with the following errors:");

			foreach (var operation in diagnostics)
			{
				_log.Error(operation);
			}
		}
	}

	public class HotReloadClientOperation
	{
		#region Current
		[ThreadStatic]
		private static HotReloadClientOperation? _opForCurrentUiThread;

		internal static HotReloadClientOperation? GetForCurrentThread()
			=> _opForCurrentUiThread;

		internal void SetCurrent()
		{
			Debug.Assert(_opForCurrentUiThread == null, "Only one operation should be active at once for a given UI thread.");
			_opForCurrentUiThread = this;
		}


Review comment (suggestion):
So `diagnostics` will be `null`, check is redundant

Code after:
			{
				this.Log().Error("Failed to notify the status changed.", error);
			}
		}

		private Status BuildStatus()
		{
			var serverState = _serverState ?? (_localOperations.Any() ? HotReloadState.Ready /* no info */ : HotReloadState.Initializing);
			var localState = _localOperations.Any(op => op.Result is null) ? HotReloadState.Processing : HotReloadState.Ready;
			var globalState = _serverState switch
			{
				HotReloadState.Disabled => HotReloadState.Disabled,
				HotReloadState.Initializing => HotReloadState.Initializing,
				_ => (HotReloadState)Math.Max((int)serverState, (int)localState)
			};

			return new(globalState, (serverState, _serverOperations.Values.ToImmutableArray()), (localState, _localOperations));
		}
	}

#if HAS_UNO_WINUI
	private void ReportDiagnostics(IImmutableList<string>? diagnostics)
	{
		if (diagnostics is { Count: > 0 })
		{
			_log.Error("The Hot Reload compilation failed with the following errors:");

			foreach (var operation in diagnostics)
			{
				_log.Error(operation);
			}
		}
	}
#endif

	public class HotReloadClientOperation
	{
		#region Current
		[ThreadStatic]
		private static HotReloadClientOperation? _opForCurrentUiThread;

		internal static HotReloadClientOperation? GetForCurrentThread()
			=> _opForCurrentUiThread;

		internal void SetCurrent()
		{
			Debug.Assert(_opForCurrentUiThread == null, "Only one operation should be active at once for a given UI thread.");
			_opForCurrentUiThread = this;
		}

		internal void ResignCurrent()