question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Call to ParkingWindow.RemoveReflectChild() causes Cross-thread exception under load

See original GitHub issue
  • .NET Core Version:

Version: 5.0.0-alpha.1.20072.3

  • Have you experienced this same bug with .NET Framework?: No

Problem description:

Call to ParkingWindow.RemoveReflectChild() causes Cross-thread exception under load

Expected behavior: There should be no error when GC frees the resources.

Minimal repro: Run WinForms app under load and trigger GC to free resources.

System.InvalidOperationException: 'Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on.'
>	System.Windows.Forms.dll!System.Windows.Forms.Control.Handle.get() Line 2502	C#
 	System.Windows.Forms.Primitives.dll!Interop.User32.GetWindowThreadProcessId(IHandle hWnd, out uint lpdwProcessId) Line 17	C#
 	System.Windows.Forms.dll!System.Windows.Forms.Application.ParkingWindow.RemoveReflectChild() Line 81	C#
 	System.Windows.Forms.dll!System.Windows.Forms.Control.ReflectParent.set(System.Windows.Forms.Control value) Line 3137	C#
 	System.Windows.Forms.dll!System.Windows.Forms.Control.UpdateReflectParent(bool findNewParent) Line 11630	C#
 	System.Windows.Forms.dll!System.Windows.Forms.Control.Dispose(bool disposing) Line 5188	C#
 	System.ComponentModel.Primitives.dll!System.ComponentModel.Component.~Component() Line 22	C#
 	[Native to Managed Transition]	

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
weltkantecommented, Mar 5, 2020

PR #2304 changed more calls in the same way, no idea how many of those can cause regressions though.

1reaction
RussKiecommented, Mar 5, 2020

I checked v3.x are unaffected, which is good.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cross-thread operation not valid: Control accessed from a ...
Control from different thread than UI thread will cause cross-thread exception. Since there is only one thread, all UI operations are queued ...
Read more >
How to make thread-safe calls to controls - Windows Forms ...
Control accessed from a thread other than the thread it was created on. The InvalidOperationException always occurs for unsafe cross-thread ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found