Repository navigation
fix(device): contain SafeTrace formatting and document DeviceState.Streaming - #813
Conversation
Switch the five eager SafeTrace($"…{ex}") sites on the stream-event and
discovery isolation catches to the Func<string> overload so a throwing
ToString stays inside the guard.
Document that DeviceState.Streaming is never assigned and that live
acquisition state is IStreamingDevice.IsStreaming.
Co-authored-by: Tyler Kron <tylerkron@gmail.com>
…ontained
Each fact fails on main's eager SafeTrace($"...{ex}") and passes with the
SafeTrace(Func<string>) composition.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PR Summary by QodoContain trace formatting failures during streaming and discovery
AI Description
Diagram
High-Level Assessment
Files changed (5)
|
Code Review by Qodo
1.
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
/agentic_review |
|
Code review by qodo was updated up to the latest commit 2790f0b |
What was wrong
Several "isolation" catches in Core exist so a misbehaving consumer can't break streaming or discovery: they catch an exception thrown by an event subscriber (or a consumer-supplied
IDeviceFinder) and write it to a trace line. But the trace line was composed before it reached the guard —SafeTrace($"... {ex}")rendersex.ToString()eagerly, outside the try. An exception whoseToString(orMessage) throws therefore escaped the very catch meant to contain it:DaqifiStreamingDevice.RaiseGapDetected— the frame that triggered the gap was dropped by the per-frame catch instead of being decoded.DaqifiStreamingDevice.RaiseStreamFrameDiscarded— the exception escaped the discard report.AllTransportsDeviceFinder.RaiseIsolatedand bothSafeDiscoverAsyncoverloads — one bad subscriber or one bad finder faulted the whole discovery pass.Separately,
DeviceState.Streamingwas documented as "device is actively streaming data", but nothing ever assigns it: after initializationDaqifiDevice.StatestaysReady, and live acquisition isIStreamingDevice.IsStreaming.Fix
SafeTrace(Func<string>), which composes the line inside the guard — the same overloadSerialStreamTransportandTcpStreamTransportalready use for the same reason.DeviceState.Streaming's doc now says it is never assigned and points toIsStreaming. The member stays (shipped; removing it isCP0002). No public API change.Tests
Five new facts throw an exception whose
ToStringthrows (sameUnrenderableExceptionshape asDropPathSubscriberIsolationTests):DaqifiStreamingDeviceDecodeTests:GapDetected_SubscriberExceptionThatCannotRenderItself_DoesNotSkipFrameDecode,Decode_DiscardSubscriberExceptionThatCannotRenderItself_DoesNotEscapeAllTransportsDeviceFinderTests: subscriber, finder (token overload), finder (timeout overload)All five fail against
main's source and pass with this change. Full solution:dotnet build -c Release0 warnings;dotnet test -c Releasegreen on net9.0 and net10.0.Related: #806 moves
DeviceFinderBase.RaiseIsolatedonto the sameSafeTrace(Func<string>)overload; the two PRs touch different files and agree on the pattern.🤖 Generated with Claude Code