Repository navigation
fix a throwing availability handler ending the process - #2
Merged
trypsynth merged 1 commit intoNov 12, 2026
Merged
Conversation
An exception that leaves an UnmanagedCallersOnly method cannot cross back into prism, so the runtime ends the process. The availability and baseline callbacks now drop a handler's exception, as the log and audio callbacks already do, and polling carries on.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An exception thrown by an
AvailabilityChangedorAvailabilityBaselineEstablishedhandler escapesOnAvailabilityChangedorOnAvailabilityBaseline. Those areUnmanagedCallersOnlymethods called on prism's poll thread, so the runtime ends the whole process instead of the exception reaching anyone.This wraps both callbacks the way
PrismLog.DeliverandBackend.DeliverAudioalready handle theirs: the handler's exception is dropped and polling carries on. ThePrismOptionsdocs for both handlers now say so.AvailabilityTests.KeepsPollingWhenHandlersThrowuses a custom backend that is toggled off and on, with both handlers throwing. Without the fix, the test host crashes at the baseline handler ("Test host process crashed: Unhandled exception. System.InvalidOperationException: A failing baseline handler."). With it, both changes are still reported. All 57 tests pass on win-x64, anddotnet format --verify-no-changesis clean.