Closed paulegradie closed 5 months ago
@paulegradie looking at the Roslyn source, we should indeed be using GetSemanticModelAsync
: https://github.com/dotnet/roslyn/blob/82dac747490ba681577b9d1a47524b9f4e0af137/src/Workspaces/Core/Portable/Workspace/Solution/Document.cs#L236-L245
/// <summary> /// Gets the current semantic model for this document if the model is already computed and still cached. /// In almost all cases, you should call <see cref="GetSemanticModelAsync"/>, which will compute the semantic model /// if necessary. /// </summary>
So this PR should be good to go. One small comment for the review.
Fixes #94
Ahh - good find. PR's been updated @andrewabest
I'll leave any additional conversions to GetAwaiter() for now.
Description
This PR swaps
document.TryGetSemanticModel
forsemanticModel = document.GetSemanticModelAsync().Result
.This PR is based on the details provided in this related issue: https://github.com/andrewabest/Conventional/issues/94 There is a reproduction if this issue linked in the issue.
The summary is:
TryGetSemanticModel
doesn't seem to work as expected. Testing indicates thatGetSemanticModelAsync
may be a suitable alternative.