[GH-ISSUE #809] v2.27.3.0 "The calling thread must be STA" per-frame exception #2480

Closed
opened 2026-03-01 18:58:16 +03:00 by kerem · 0 comments
Owner

Originally created by @wizzard0 on GitHub (Mar 19, 2021).
Original GitHub issue: https://github.com/NickeManarin/ScreenToGif/issues/809

Details
During full-screen recording, after switching apps a number of times, I get an 'Unhandled exception' window each frame.
Errors stop after pressing F7 to stop recording.

STR:
Fastest way to reproduce (5-10 clicks) is to switch between Notepad and a website pinned as an app in Microsoft Edge, trying to simultaneously type something in either window.

Machine:

Win10 10.0.19042.0, 16G RAM
Intel(R) Core(TM) i7-6600U CPU @ 2.60GHz
NVIDIA GeForce GTX 965M @ 59Hz v27.21.14.5167
Intel(R) HD Graphics 520 @ 59Hz v24.20.100.6293
ScreenToGif v2.27.3.0

Monitor:
3840x2160, "Second screen only" mode, using Intel graphics

Exception:

► Title - 
	On dispacher unhandled exception - Unknown
▬ Message - 
	The calling thread must be STA, because many UI components require this.
○ Type - 
	System.InvalidOperationException
♦ [Version] Date/Hour - 
	[2.27.3] 03/19/2021 05:21:38
▲ Source - 
	PresentationCore
▼ TargetSite - 
	Void .ctor()
♠ StackTrace - 
   at System.Windows.Input.InputManager..ctor()
   at System.Windows.Input.InputManager.GetCurrentInputManagerImpl()
   at System.Windows.Input.RoutedCommand.Execute(Object parameter, IInputElement target)
   at ScreenToGif.Windows.NewRecorder.<PrepareNewCapture>b__71_0(Exception exception)
   at ScreenToGif.Capture.DirectImageCapture.CaptureWithCursor(FrameInfo frame)
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at ScreenToGif.Capture.DirectImageCapture.<CaptureWithCursorAsync>d__33.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at ScreenToGif.Windows.NewRecorder.<CursorAsync_Elapsed>d__54.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
----------------------------------

Other than that, really awesome app! Love the UI and all the details put into it.

Originally created by @wizzard0 on GitHub (Mar 19, 2021). Original GitHub issue: https://github.com/NickeManarin/ScreenToGif/issues/809 **Details** During full-screen recording, after switching apps a number of times, I get an 'Unhandled exception' window each frame. Errors stop after pressing F7 to stop recording. **STR**: Fastest way to reproduce (5-10 clicks) is to switch between Notepad and a website pinned as an app in Microsoft Edge, trying to simultaneously type something in either window. **Machine**: ``` Win10 10.0.19042.0, 16G RAM Intel(R) Core(TM) i7-6600U CPU @ 2.60GHz NVIDIA GeForce GTX 965M @ 59Hz v27.21.14.5167 Intel(R) HD Graphics 520 @ 59Hz v24.20.100.6293 ScreenToGif v2.27.3.0 ``` **Monitor**: 3840x2160, "Second screen only" mode, using Intel graphics **Exception**: ``` ► Title - On dispacher unhandled exception - Unknown ▬ Message - The calling thread must be STA, because many UI components require this. ○ Type - System.InvalidOperationException ♦ [Version] Date/Hour - [2.27.3] 03/19/2021 05:21:38 ▲ Source - PresentationCore ▼ TargetSite - Void .ctor() ♠ StackTrace - at System.Windows.Input.InputManager..ctor() at System.Windows.Input.InputManager.GetCurrentInputManagerImpl() at System.Windows.Input.RoutedCommand.Execute(Object parameter, IInputElement target) at ScreenToGif.Windows.NewRecorder.<PrepareNewCapture>b__71_0(Exception exception) at ScreenToGif.Capture.DirectImageCapture.CaptureWithCursor(FrameInfo frame) at System.Threading.Tasks.Task`1.InnerInvoke() at System.Threading.Tasks.Task.Execute() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at ScreenToGif.Capture.DirectImageCapture.<CaptureWithCursorAsync>d__33.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at ScreenToGif.Windows.NewRecorder.<CursorAsync_Elapsed>d__54.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) ---------------------------------- ``` Other than that, really awesome app! Love the UI and all the details put into it.
kerem 2026-03-01 18:58:16 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ScreenToGif#2480
No description provided.