I've found (unfortunately) that the TryGetSemanticModel approach to resolving semantic models from a given document does not actually work 😓. I attempted to find workarounds, however nothing appears to solve the problem.
I've implemented a reproduction of the problem for you to review - but the short of it is: The tests that I've written in the repo suggest that we can swap the TryGetSemanticModel out with GetSemanticModelAsync().Result.
Testing:
The Conventional.Roslyn solution is a bit funky and refuses to build for me, so I haven't created a nuget package locally and run an end-to-end test on this
The repro below demonstrates the efficacy of the new approach - hopefully that satisfies. But - it would be prudent perhaps to do the E2E test on your end.
Either way - this update can't make any thing worse. :D
Description
I've found (unfortunately) that the
TryGetSemanticModel
approach to resolving semantic models from a given document does not actually work 😓. I attempted to find workarounds, however nothing appears to solve the problem.I've implemented a reproduction of the problem for you to review - but the short of it is: The tests that I've written in the repo suggest that we can swap the
TryGetSemanticModel
out withGetSemanticModelAsync().Result
.Testing:
Either way - this update can't make any thing worse. :D
Reproduction:
https://github.com/paulegradie/Conventional.Repros/blob/main/SemanticModelNotFound/SemanticModelNotFound.Tests/SemanticModelNotFoundTest.cs