mhutch / MonoDevelop.MSBuildEditor

Improved MSBuild editing support
Other
228 stars 26 forks source link

TaskMetadataBuilder causing infinite loop by overlapping reads/writes to a dictionary #245

Closed davkean closed 2 months ago

davkean commented 2 months ago

Visual Studio's CPU telemetry has caught TaskMetadataBuilder corrupting a dictionary by overlapping reads/writes from multiple threads, resulting in GetTaskAssembly entering a infinite loop which it will never recover.

Please replace the underlying dictionary with a collection that supports concurrent reads/writes, such as ConcurrentDictionary<TKey, TValue>.

monodevelop.msbuild.dll!MonoDevelop.MSBuild.Language.MSBuildParserContext.GetCachedOrParse
monodevelop.msbuild.dll!MonoDevelop.MSBuild.Language.MSBuildParserContext.ParseImport
monodevelop.msbuild.dll!MonoDevelop.MSBuild.Language.MSBuildDocument.Build
monodevelop.msbuild.dll!MonoDevelop.MSBuild.Language.MSBuildInferredSchema.Build
monodevelop.msbuild.dll!MonoDevelop.MSBuild.Language.MSBuildInferredSchema.CollectTaskDefinition
monodevelop.msbuild.editor.dll!MonoDevelop.MSBuild.Editor.Roslyn.TaskMetadataBuilder.CreateTaskInfo
monodevelop.msbuild.editor.dll!MonoDevelop.MSBuild.Editor.Roslyn.TaskMetadataBuilder.GetTaskAssembly
mscorlib.dll!System.Collections.Generic.Dictionary`[System.ValueTuple`[System.__Canon,System.__Canon,System.__Canon],System.Nullable`[System.ValueTuple`[System.__Canon,System.__Canon]]].set_Item
mscorlib.dll!System.Collections.Generic.Dictionary`[System.ValueTuple`[System.__Canon,System.__Canon,System.__Canon],System.Nullable`[System.ValueTuple`[System.__Canon,System.__Canon]]].Insert
mhutch commented 2 months ago

This is fixed by 67116255c4119f0a51a304d90153c591b6e565d0