Background and motivation
Control.CheckForIllegalCrossThreadCalls is Boolean value that is not thread safe.
API Proposal
Replace with
Control.BeginIllegalCrossThreadCall() => Interlocked.Increment(...);
Control.EndIllegalCrossThreadCall() => Interlocked.Decrement(...);
Control.CheckForIllegalCrossThreadCalls => (Interlocked.Read(...) == 0);
### API Usage
```csharp
Control.BeginIllegalCrossThreadCall() ;
try
{
// Get control handle, etc.
nint handle = control.Handle;
}
finally
{
Control.EndIllegalCrossThreadCall() ;
}
Alternative Designs
Control.CheckForIllegalCrossThreadCalls could be [ ThreadStatic ].
Risks
No response
Will this feature affect UI controls?
Yes.
Will VS Designer need to support the feature? No
What impact will it have on accessibility? No
Will this feature need to be localized or be localizable? No
Background and motivation
Control.CheckForIllegalCrossThreadCalls is Boolean value that is not thread safe.
API Proposal
Replace with
Alternative Designs
Control.CheckForIllegalCrossThreadCalls could be [ ThreadStatic ].
Risks
No response
Will this feature affect UI controls?
Yes.
Will VS Designer need to support the feature? No
What impact will it have on accessibility? No
Will this feature need to be localized or be localizable? No