public ValueWatcher(MetadataClientImpl client, string path, Action <ValueWatcher, string> changeAction) { this.changeAction = changeAction; this.client = client; this.path = path; cancellationTokenSource = new CancellationTokenSource(); ready = new ManualResetEventSlim(false); waitTask = Task.Run(WaitForChange); if (!ready.Wait(TimeSpan.FromSeconds(10))) { var exception = waitTask.Exception; var innerException = exception?.InnerExceptions.FirstOrDefault() ?? exception; throw new InvalidOperationException($"Unable to wait for changes on {path}", innerException); } }