Open garuma opened 5 years ago
This would mean adding additional files to the compilation which contain the semantics: https://github.com/Microsoft/vs-threading/blob/34c6eae89e0514ca6c6e72d411629cdb4cd88d2e/src/Microsoft.VisualStudio.Threading.Analyzers/VSTHRD109AvoidAssertInAsyncMethodsAnalyzer.cs#L51 https://github.com/Microsoft/vs-threading/blob/34c6eae89e0514ca6c6e72d411629cdb4cd88d2e/src/Microsoft.VisualStudio.Threading.Analyzers/CommonInterest.cs#L168
MS.VS.Threading has a an analyzer that know about certain VS APIs and the requirement that they need to be run on the main thread to work properly. They then check that any code calling them is properly flagged with
ThrowIfNotOnUIThread
and such.