Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emit VSTHRD003 warning when awaiting on foreign tasks from properties #1244

Merged
merged 1 commit into from
Oct 24, 2023

Conversation

AArnott
Copy link
Member

@AArnott AArnott commented Oct 23, 2023

Fixes #1224

if (symbol is IFieldSymbol field)
{
// Allow the TplExtensions.CompletedTask and related fields.
if (field.ContainingType.Name == Types.TplExtensions.TypeName && field.BelongsToNamespace(Types.TplExtensions.Namespace) &&

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

both this and the conditional on 88 are a little bit difficult to grok based on initial read. Consider making a method with a descriptive name to make it easier to understand at a glance.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree it is. I have a code comment above that explains it, and this is the method that keeps things simple for the caller. :)

@AArnott AArnott merged commit 3920e97 into microsoft:main Oct 24, 2023
@AArnott AArnott deleted the fix1224 branch October 24, 2023 19:09
@AArnott AArnott added this to the v17.9 milestone Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VSTHRD003 should fire when awaiting on TCS.Task
2 participants