Keep Graphics Capture on the UI thread and bump to 1.0.2 - #70
Merged
Conversation
1.0.1 still crashed in the Store with AccessViolationException from IObjectReference.Finalize. Disposing session and frame fields was not enough: GraphicsCapturePicker was abandoned after the pick, and CreateFreeThreaded built frame RCWs on a worker. Resize triggered GC and Marshal.Release ran off the apartment. Create a WinRT DispatcherQueue on the WPF UI thread, switch the frame pool to Create so FrameArrived stays there, and Release every capture RCW on that thread, including the picker. VersionPrefix is 1.0.2.
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.
1.0.1 still crashed in the Store with
AccessViolationExceptionfromIObjectReference.Finalize(0xC0000005). Disposing the session and frame fields was not enough.Two RCWs were still left for the GC, and both match create-LiveView-then-resize:
GraphicsCapturePickeris notIDisposable. The pick method allocated it and dropped it. Resize allocates, GC runs, the finalizerMarshal.Releases off the UI apartment.CreateFreeThreadedbuilt frames on a worker. Rate-limiting disposed most of those wrappers on that worker. In a packaged process they are apartment-bound.Create a WinRT
DispatcherQueueon the WPF UI thread and hold the native controller for the process lifetime. Switch the frame pool toCreatesoFrameArrivedstays on that thread.Releaseevery capture RCW there, including the picker.VersionPrefixis 1.0.2 so this can go to the Store (identity1.0.2.0).Verified locally:
dotnet build Whiteboard.sln -c Releaseis clean, Core smoke tests pass. Confirmation is still a packaged install on a machine that crashed on 1.0.1; the portable ZIP never hit this path.