{"record":{"id":"925bbfc38f576734","repo":"mgth/LittleBigMouse","slug":"associate-a-samsung-tizen-display-first","errorCode":null,"errorMessage":"Associate a Samsung Tizen display first.","messagePattern":"Associate a Samsung Tizen display first\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"LittleBigMouse.Plugins/LittleBigMouse.Plugin.Vcp.Avalonia/SamsungTizen/SamsungTizenService.cs","lineNumber":142,"sourceCode":"        PacketCount = 3,\n        Port = 9,\n        DelayBetweenPackets = TimeSpan.FromMilliseconds(100),\n    };\n\n    public Task PowerOnAsync(string monitorId, CancellationToken cancellationToken = default)\n    {\n        var configuration = RequiredConfiguration(monitorId);\n        if (string.IsNullOrWhiteSpace(configuration.MacAddress))\n            throw new InvalidOperationException(\"Enter the monitor Wi-Fi MAC address before using Wake-on-LAN.\");\n        return WakeOnLan.SendAsync(\n            configuration.MacAddress, WakeOnLanBurst, cancellationToken: cancellationToken);\n    }\n\n    SamsungTizenConfiguration RequiredConfiguration(string monitorId)\n    {\n        var configuration = _store.Get(monitorId);\n        if (configuration is null || string.IsNullOrWhiteSpace(configuration.IpAddress))\n            throw new InvalidOperationException(\"Associate a Samsung Tizen display first.\");\n        return configuration;\n    }\n\n    SamsungTizenClient ClientFor(string monitorId, SamsungTizenConfiguration configuration)\n    {\n        lock (_lock)\n        {\n            if (_clients.TryGetValue(monitorId, out var client)) return client;\n            client = new SamsungTizenClient(configuration.IpAddress, configuration.Token);\n            _clients[monitorId] = client;\n            return client;\n        }\n    }\n\n    public async ValueTask DisposeAsync()\n    {\n        SamsungTizenClient[] clients;\n        lock (_lock)","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/mgth/LittleBigMouse/blob/7a42f01d47d99d223b8ee33ba4019af82adf1c48/LittleBigMouse.Plugins/LittleBigMouse.Plugin.Vcp.Avalonia/SamsungTizen/SamsungTizenService.cs#L124-L160","documentation":"SamsungTizenService.RequiredConfiguration fetches the stored SamsungTizenConfiguration for a monitorId and validates that it exists and has a non-blank IpAddress. If not, it throws InvalidOperationException: no Samsung Tizen display has been associated with this monitor, so no remote-control operation can proceed.","triggerScenarios":"Calling any service operation that resolves a configuration (PowerOnAsync, power/volume commands, ClientFor) for a monitorId whose stored configuration is null or whose IpAddress is null/whitespace.","commonSituations":"The user never ran the Samsung Tizen association/pairing flow for that monitor; the monitor is a non-Tizen display wrongly assigned to the Tizen plugin; configuration storage was reset or migrated and the entry was lost.","solutions":["Run the Samsung Tizen association/pairing flow to create a configuration with an IP address for this monitorId","Verify the display is actually a Samsung Tizen model and is mapped to the correct monitorId","Check that the configuration store persists and returns the saved entry (no reset/corruption)"],"exampleFix":"// before\nawait service.PowerOffAsync(monitorId); // throws if unassociated\n// after\nif (!service.IsAssociated(monitorId))\n    throw new InvalidOperationException(\"Associate a Samsung Tizen display in settings first.\");\nawait service.PowerOffAsync(monitorId);","handlingStrategy":"validation","validationCode":"var config = store.Get(monitorId);\nif (config is null || string.IsNullOrWhiteSpace(config.IpAddress))\n    throw new InvalidOperationException(\"Associate a Samsung Tizen display first.\");","typeGuard":"static bool IsAssociated(SamsungTizenConfiguration? c) =>\n    c is not null && !string.IsNullOrWhiteSpace(c.IpAddress);","tryCatchPattern":"try\n{\n    await service.PowerOnAsync(monitorId, ct);\n}\ncatch (InvalidOperationException)\n{\n    // navigate user to the Samsung Tizen association flow\n}","preventionTips":["Always run the association flow before offering Tizen power/volume controls","Verify the target display is a Samsung Tizen model","Persist configuration reliably and handle store resets","Check association state when listing monitors in the UI"],"tags":["configuration","samsung-tizen","prerequisite","not-associated"],"backgroundTag":"missing-required-config","analyzedSha":"7a42f01d47d99d223b8ee33ba4019af82adf1c48","analyzedAt":"2026-09-16T00:35:00.514Z","contentChangedAt":"2026-09-16T00:35:00.514Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}