Open
Description
Bug description
Callers to this method have warning VSTHRD010
private void UpdateColoursFromFontsAndColors()
{
ThreadHelper.JoinableTaskFactory.Run(async () =>
{
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
var success = fontAndColorStorage.OpenCategory(ref categoryWithCoverage, storeFlags);
if (success == VSConstants.S_OK)
{
CoverageTouchedArea = GetColor("Coverage Touched Area");
CoverageNotTouchedArea = GetColor("Coverage Not Touched Area");
CoveragePartiallyTouchedArea = GetColor("Coverage Partially Touched Area");
}
fontAndColorStorage.CloseCategory();
//throw ?
requiresFromFontsAndColours = false;
});
}
private System.Windows.Media.Color GetColor(string displayName)
{
ThreadHelper.ThrowIfNotOnUIThread();
var touchAreaInfo = new ColorableItemInfo[1];
var getItemSuccess = fontAndColorStorage.GetItem(displayName, touchAreaInfo);
if (getItemSuccess == VSConstants.S_OK)
{
return ParseColor(touchAreaInfo[0].crBackground);
}
throw new Exception("Failed to get color");
}
Remove the calls to GetColor and no warnings.
Make GetColor a local function ( without ThreadHelper.ThrowIfNotOnUIThread() ) and no warnings
Expected behavior
No warnings
Actual behavior
warnings
- Version used: Microsoft.VisualStudio.SDK - 17.0.31902.203
- Application (if applicable):
Additional context
Add any other context about the problem here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment