-
Notifications
You must be signed in to change notification settings - Fork 148
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
Provide a non-net472 alternative to ThrowIfNotOnUIThread to satisfy VSTHRD010 #1025
Comments
One place where this would be helpful is in IDE components or extensions that dual target VS for Windows and VS for Mac.
Note that some of these components build .net472. The analyzers currently recommend that devs take a dependency on ThreadHelper, which doesn't exist on Mac. It's difficult explaining to those new to the area to ignore the analyzer. I'd recommend:
|
VSTHRD010 doesn't ask for So, if you have a non-VS app and want to use this analyzer, that's totally fine. And if you provide your own AdditionalFile like we do in vssdk-analyzer, it will even encourage using your own API. You could even write your own JTF extension method that calls an app-specific Throw method, and use AdditionalFiles to direct user code to use your extension method. But yes, it probably makes sense to define the method within this library because it would make app-agnostic code easier to write. |
I would be inclined from an API standpoint to add the method to |
Is your feature request related to a problem? Please describe.
VSTHRD010 asks to use
ThreadHelper.ThrowIfNotOnUIThread()
for sync methods.ThreadHelper
is only available for thenet472
target.Microsoft.VisualStudio.Threading
is available for other targets as well.Describe the solution you'd like
Microsoft.VisualStudio.Threading
should provide aThrowIfNotOnUIThread()
method for all platforms for which VSTHRD010 is generated.The VSTHRD010 error message should be updated to instruct using the
ThrowIfNotOnUIThread()
provided byMicrosoft.VisualStudio.Threading
.The text was updated successfully, but these errors were encountered: