microsoft / microsoft/vs-threading
VSTHRD010 flags on chained constructor call to base, thread-affinitized type
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 1k
- Forks
- 160
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 28
Description
Bug description
A class that derives from a thread-affinitized base class is expected to assert thread affinity before the chained constructor call, which is impossible.
Repro steps
Given a class declared to derive from these types:
internal abstract class TerminalWindowBase : ToolWindowPane, IVsWindowFrameEvents, IOleCommandTarget, IVsDebuggerEvents
Another class
public TerminalWindowRenderer(TerminalWindowState state)
#pragma warning disable VSTHRD010
: base(state)
#pragma warning restore VSTHRD010
{
}
Expected behavior
The warning should not be emitted at the location suppressed above.
- Version used: 17.3.44
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the VSTHRD010 analyzer and the diagnostic logic for chained constructor calls to thread-affinitized base types. Reproduce the TerminalWindowRenderer example with the TerminalWindowBase inheritance shown in the issue, then verify that the warning is not emitted at the suppressed base(state) location.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100