You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Inherit thread affinity from base types and members #231
Members derived from a member that requires the main thread should also have a main thread requirement
By a derived member are you talking about an override member?
Members which have a main thread requirement due to inheritance should not report a warning if they are missing a ThrowIfNotOnUIThread call
I disagree. There is no guarantee that the caller has the threading analyzers applied to their project with the right analyzer turned to warning/error. At runtime something that requires the UI thread should still throw if it's not called on the UI thread in order to prefer throwing exceptions over deadlocking.
By a derived member are you talking about an override member?
override: Yes
Explicit interface implementation: Yes
Implicit interface implementation: Probably, but could be persuaded otherwise and may not be necessary. Biggest advantage would be code implementing an interface provided by some service, where the service only ever calls into the interface from the UI thread. By marking the interface and having it propagate to implementations, the analyzer could assume the entry point to each method in the implementation is on the UI thread.
I disagree. There is no guarantee that the caller has the threading analyzers applied to their project with the right analyzer turned to warning/error. At runtime something that requires the UI thread should still throw if it's not called on the UI thread in order to prefer throwing exceptions over deadlocking.
This is fine, but if the behavior is kept it should use a different diagnostic ID. Otherwise it's an overwhelming source of noise for code that defines hundreds or thousands of event handlers for UI events.
Event handlers I don't mind removing the requirement from under the conditions you proposed. It's members that are accessible in other ways that I think should still defend themselves from improper calling.
That seems more relevant for a library or application with a public API. For a contained application, it's just noise (all the entry points to affinitized code would be analyzed separately).
Activity
AArnott commentedon Apr 4, 2018
By a derived member are you talking about an
overridemember?I disagree. There is no guarantee that the caller has the threading analyzers applied to their project with the right analyzer turned to warning/error. At runtime something that requires the UI thread should still throw if it's not called on the UI thread in order to prefer throwing exceptions over deadlocking.
sharwell commentedon Apr 4, 2018
override: Yessharwell commentedon Apr 4, 2018
This is fine, but if the behavior is kept it should use a different diagnostic ID. Otherwise it's an overwhelming source of noise for code that defines hundreds or thousands of event handlers for UI events.
AArnott commentedon Apr 4, 2018
Event handlers I don't mind removing the requirement from under the conditions you proposed. It's members that are accessible in other ways that I think should still defend themselves from improper calling.
sharwell commentedon Apr 4, 2018
That seems more relevant for a library or application with a public API. For a contained application, it's just noise (all the entry points to affinitized code would be analyzed separately).
Bump powershell from 7.3.9 to 7.4.0 (microsoft#231)