pharring / EditorGuidelines

A Visual Studio extension that adds vertical column guides to the text editor
MIT License
113 stars 17 forks source link

OnImportsSatisfied incorrectly assumes it is invoked on the main thread #131

Open sharwell opened 1 month ago

sharwell commented 1 month ago

Recent versions of Visual Studio are calling this method on a background thread as part of "warming up" the IDE before parts are needed. Depending on timing, this results in a deadlock. Like all MEF parts, it cannot assume it is called on a particular thread.

https://github.com/pharring/EditorGuidelines/blob/26d146201a3d56b3f741cf860b5eea44cb42e726/src/ColumnGuide/ColumnGuideFactory.cs#L47

pharring commented 4 weeks ago

Thanks, @sharwell. Is the deadlock theoretical, or do you have evidence of one? A quick review of the code doesn't appear to assume any particular thread.

Do you see anything I'm missing?

sharwell commented 4 weeks ago

Is the deadlock theoretical, or do you have evidence of one?

Observed locally and had to disable the feature, also there is an internal telemetry bug that was closed as external. Appears to be related to a recent change to improve startup performance.

pharring commented 4 weeks ago

Thanks. The change to improve startup performance, would it be in 17.11 preview 1?

sharwell commented 4 weeks ago

I'm not sure when it was introduced. I'm currently on Version 17.11.0 Preview 3.0 [35004.230.main]