mhutch / MonoDevelop.MSBuildEditor

Improved MSBuild editing support
Other
228 stars 26 forks source link

Collection was modified in MSBuildParserContext.ResolveImport #207

Open KirillOsenkov opened 7 months ago

KirillOsenkov commented 7 months ago

I opened a proj file and saw this exception

System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
   at void ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
   at bool System.Collections.Generic.List<T>+Enumerator.MoveNextRare()
   at IEnumerable<string> MonoDevelop.MSBuild.Evaluation.MSBuildEvaluatorExtensions.EvaluateWithPermutation(IMSBuildEvaluationContext context, string prefix, ExpressionNode expression, int depth)+MoveNext() in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Evaluation/MSBuildEvaluatorExtensions.cs:line 136
   at IEnumerable<string> MonoDevelop.MSBuild.Evaluation.MSBuildEvaluatorExtensions.EvaluateWithPermutation(IMSBuildEvaluationContext context, string prefix, ExpressionNode expression, int depth)+MoveNext() in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Evaluation/MSBuildEvaluatorExtensions.cs:line 167
   at IEnumerable<string> MonoDevelop.MSBuild.Evaluation.MSBuildEvaluatorExtensions.EvaluatePathWithPermutation(IMSBuildEvaluationContext context, ExpressionNode pathExpression, string baseDirectory)+MoveNext() in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Evaluation/MSBuildEvaluatorExtensions.cs:line 98
   at IEnumerable<TResult> System.Linq.Enumerable.SelectManyIterator<TSource, TResult>(IEnumerable<TSource> source, Func<TSource, IEnumerable<TResult>> selector)+MoveNext()
   at IEnumerable<Import> MonoDevelop.MSBuild.Language.MSBuildParserContext.ResolveImport(IMSBuildEvaluationContext fileContext, string thisFilePath, ExpressionNode importExpr, string importExprString, string sdk, SdkInfo resolvedSdk, bool isImplicitImport)+MoveNext() in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildParserContext.cs:line 138
   at void MonoDevelop.MSBuild.Language.MSBuildDocument.ResolveImport(MSBuildImportElement element, MSBuildParserContext parseContext, MSBuildImportResolver importResolver) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildDocument.cs:line 206
   at void MonoDevelop.MSBuild.Language.MSBuildDocument.ResolveImports(MSBuildProjectElement project, MSBuildParserContext context) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildDocument.cs:line 141
   at void MonoDevelop.MSBuild.Language.MSBuildDocument.Build(XDocument doc, MSBuildParserContext context) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildDocument.cs:line 69
   at Import MonoDevelop.MSBuild.Language.MSBuildParserContext.ParseImport(Import import) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildParserContext.cs:line 91
   at Import MonoDevelop.MSBuild.Language.MSBuildParserContext.GetCachedOrParse(string importExpr, string resolvedFilename, string sdk, SdkInfo resolvedSdk, DateTime mtimeUtc, bool isImplicitImport) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildParserContext.cs:line 109
   at IEnumerable<Import> MonoDevelop.MSBuild.Language.MSBuildParserContext.ResolveImport(IMSBuildEvaluationContext fileContext, string thisFilePath, ExpressionNode importExpr, string importExprString, string sdk, SdkInfo resolvedSdk, bool isImplicitImport)+MoveNext() in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildParserContext.cs:line 203
   at void MonoDevelop.MSBuild.Language.MSBuildDocument.ResolveImport(MSBuildImportElement element, MSBuildParserContext parseContext, MSBuildImportResolver importResolver) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildDocument.cs:line 206
   at void MonoDevelop.MSBuild.Language.MSBuildDocument.ResolveImports(MSBuildProjectElement project, MSBuildParserContext context) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildDocument.cs:line 141
   at void MonoDevelop.MSBuild.Language.MSBuildDocument.Build(XDocument doc, MSBuildParserContext context) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildDocument.cs:line 69
   at Import MonoDevelop.MSBuild.Language.MSBuildParserContext.ParseImport(Import import) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildParserContext.cs:line 91
   at Import MonoDevelop.MSBuild.Language.MSBuildParserContext.GetCachedOrParse(string importExpr, string resolvedFilename, string sdk, SdkInfo resolvedSdk, DateTime mtimeUtc, bool isImplicitImport) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildParserContext.cs:line 109
   at IEnumerable<Import> MonoDevelop.MSBuild.Language.MSBuildParserContext.ResolveImport(IMSBuildEvaluationContext fileContext, string thisFilePath, ExpressionNode importExpr, string importExprString, string sdk, SdkInfo resolvedSdk, bool isImplicitImport)+MoveNext() in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildParserContext.cs:line 203
   at void MonoDevelop.MSBuild.Language.MSBuildDocument.ResolveImport(MSBuildImportElement element, MSBuildParserContext parseContext, MSBuildImportResolver importResolver) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildDocument.cs:line 206
   at void MonoDevelop.MSBuild.Language.MSBuildDocument.ResolveImports(MSBuildProjectElement project, MSBuildParserContext context) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildDocument.cs:line 141
   at void MonoDevelop.MSBuild.Language.MSBuildDocument.Build(XDocument doc, MSBuildParserContext context) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildDocument.cs:line 69
   at Import MonoDevelop.MSBuild.Language.MSBuildParserContext.ParseImport(Import import) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildParserContext.cs:line 91
   at Import MonoDevelop.MSBuild.Language.MSBuildParserContext.GetCachedOrParse(string importExpr, string resolvedFilename, string sdk, SdkInfo resolvedSdk, DateTime mtimeUtc, bool isImplicitImport) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildParserContext.cs:line 109
   at IEnumerable<Import> MonoDevelop.MSBuild.Language.MSBuildParserContext.ResolveImport(IMSBuildEvaluationContext fileContext, string thisFilePath, ExpressionNode importExpr, string importExprString, string sdk, SdkInfo resolvedSdk, bool isImplicitImport)+MoveNext() in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildParserContext.cs:line 203
   at void MonoDevelop.MSBuild.Language.MSBuildDocument.ResolveImport(MSBuildImportElement element, MSBuildParserContext parseContext, MSBuildImportResolver importResolver) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildDocument.cs:line 206
   at void MonoDevelop.MSBuild.Language.MSBuildDocument.ResolveImports(MSBuildProjectElement project, MSBuildParserContext context) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildDocument.cs:line 141
   at void MonoDevelop.MSBuild.Language.MSBuildDocument.Build(XDocument doc, MSBuildParserContext context) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildDocument.cs:line 69
   at Import MonoDevelop.MSBuild.Language.MSBuildParserContext.ParseImport(Import import) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildParserContext.cs:line 91
   at Import MonoDevelop.MSBuild.Language.MSBuildParserContext.GetCachedOrParse(string importExpr, string resolvedFilename, string sdk, SdkInfo resolvedSdk, DateTime mtimeUtc, bool isImplicitImport) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildParserContext.cs:line 109
   at IEnumerable<Import> MonoDevelop.MSBuild.Language.MSBuildParserContext.ResolveImport(IMSBuildEvaluationContext fileContext, string thisFilePath, ExpressionNode importExpr, string importExprString, string sdk, SdkInfo resolvedSdk, bool isImplicitImport)+MoveNext() in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildParserContext.cs:line 203
   at void MonoDevelop.MSBuild.Language.MSBuildDocument.ResolveImport(MSBuildImportElement element, MSBuildParserContext parseContext, MSBuildImportResolver importResolver) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildDocument.cs:line 206
   at void MonoDevelop.MSBuild.Language.MSBuildDocument.ResolveImports(MSBuildProjectElement project, MSBuildParserContext context) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildDocument.cs:line 141
   at void MonoDevelop.MSBuild.Language.MSBuildDocument.Build(XDocument doc, MSBuildParserContext context) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildDocument.cs:line 69
   at Import MonoDevelop.MSBuild.Language.MSBuildParserContext.ParseImport(Import import) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildParserContext.cs:line 91
   at Import MonoDevelop.MSBuild.Language.MSBuildParserContext.GetCachedOrParse(string importExpr, string resolvedFilename, string sdk, SdkInfo resolvedSdk, DateTime mtimeUtc, bool isImplicitImport) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildParserContext.cs:line 109
   at IEnumerable<Import> MonoDevelop.MSBuild.Language.MSBuildParserContext.ResolveImport(IMSBuildEvaluationContext fileContext, string thisFilePath, ExpressionNode importExpr, string importExprString, string sdk, SdkInfo resolvedSdk, bool isImplicitImport)+MoveNext() in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildParserContext.cs:line 203
   at void MonoDevelop.MSBuild.Language.MSBuildDocument.ResolveImport(MSBuildImportElement element, MSBuildParserContext parseContext, MSBuildImportResolver importResolver) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildDocument.cs:line 206
   at void MonoDevelop.MSBuild.Language.MSBuildDocument.ResolveImports(MSBuildProjectElement project, MSBuildParserContext context) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildDocument.cs:line 141
   at void MonoDevelop.MSBuild.Language.MSBuildDocument.Build(XDocument doc, MSBuildParserContext context) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildDocument.cs:line 69
   at Import MonoDevelop.MSBuild.Language.MSBuildParserContext.ParseImport(Import import) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildParserContext.cs:line 91
   at Import MonoDevelop.MSBuild.Language.MSBuildParserContext.GetCachedOrParse(string importExpr, string resolvedFilename, string sdk, SdkInfo resolvedSdk, DateTime mtimeUtc, bool isImplicitImport) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildParserContext.cs:line 109
   at IEnumerable<Import> MonoDevelop.MSBuild.Language.MSBuildParserContext.ResolveImport(IMSBuildEvaluationContext fileContext, string thisFilePath, ExpressionNode importExpr, string importExprString, string sdk, SdkInfo resolvedSdk, bool isImplicitImport)+MoveNext() in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildParserContext.cs:line 203
   at void MonoDevelop.MSBuild.Language.MSBuildDocument.ResolveImport(MSBuildImportElement element, MSBuildParserContext parseContext, MSBuildImportResolver importResolver) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildDocument.cs:line 206
   at void MonoDevelop.MSBuild.Language.MSBuildDocument.ResolveImports(MSBuildProjectElement project, MSBuildParserContext context) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildDocument.cs:line 141
   at void MonoDevelop.MSBuild.Language.MSBuildDocument.Build(XDocument doc, MSBuildParserContext context) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildDocument.cs:line 69
   at Import MonoDevelop.MSBuild.Language.MSBuildParserContext.ParseImport(Import import) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildParserContext.cs:line 91
   at Import MonoDevelop.MSBuild.Language.MSBuildParserContext.GetCachedOrParse(string importExpr, string resolvedFilename, string sdk, SdkInfo resolvedSdk, DateTime mtimeUtc, bool isImplicitImport) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildParserContext.cs:line 109
   at IEnumerable<Import> MonoDevelop.MSBuild.Language.MSBuildParserContext.ResolveImport(IMSBuildEvaluationContext fileContext, string thisFilePath, ExpressionNode importExpr, string importExprString, string sdk, SdkInfo resolvedSdk, bool isImplicitImport)+MoveNext() in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildParserContext.cs:line 203
   at void MonoDevelop.MSBuild.Language.MSBuildDocument.ResolveImport(MSBuildImportElement element, MSBuildParserContext parseContext, MSBuildImportResolver importResolver) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildDocument.cs:line 206
   at void MonoDevelop.MSBuild.Language.MSBuildDocument.ResolveImports(MSBuildProjectElement project, MSBuildParserContext context) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildDocument.cs:line 141
   at void MonoDevelop.MSBuild.Language.MSBuildDocument.Build(XDocument doc, MSBuildParserContext context) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildDocument.cs:line 69
   at Import MonoDevelop.MSBuild.Language.MSBuildParserContext.ParseImport(Import import) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildParserContext.cs:line 91
   at Import MonoDevelop.MSBuild.Language.MSBuildParserContext.GetCachedOrParse(string importExpr, string resolvedFilename, string sdk, SdkInfo resolvedSdk, DateTime mtimeUtc, bool isImplicitImport) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildParserContext.cs:line 109
   at IEnumerable<Import> MonoDevelop.MSBuild.Language.MSBuildParserContext.ResolveImport(IMSBuildEvaluationContext fileContext, string thisFilePath, ExpressionNode importExpr, string importExprString, string sdk, SdkInfo resolvedSdk, bool isImplicitImport)+MoveNext() in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildParserContext.cs:line 203
   at void MonoDevelop.MSBuild.Language.MSBuildDocument.ResolveImport(MSBuildImportElement element, MSBuildParserContext parseContext, MSBuildImportResolver importResolver) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildDocument.cs:line 206
   at void MonoDevelop.MSBuild.Language.MSBuildDocument.ResolveImports(MSBuildProjectElement project, MSBuildParserContext context) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildDocument.cs:line 141
   at void MonoDevelop.MSBuild.Language.MSBuildDocument.Build(XDocument doc, MSBuildParserContext context) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildDocument.cs:line 69
   at MSBuildRootDocument MonoDevelop.MSBuild.Language.MSBuildRootDocument.Parse(ITextSource textSource, string filePath, MSBuildRootDocument previous, MSBuildSchemaProvider schemaProvider, IMSBuildEnvironment environment, ITaskMetadataBuilder taskBuilder, ILogger logger, CancellationToken token) in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild/Language/MSBuildRootDocument.cs:line 163
   at Task<MSBuildParseResult> MonoDevelop.MSBuild.Editor.Completion.MSBuildBackgroundParser.StartOperationAsync(XmlParseResult input, MSBuildParseResult previousOutput, XmlParseResult previousInput, CancellationToken token)+() => { } in C:/MonoDevelop.MSBuildEditor/MonoDevelop.MSBuild.Editor/MSBuildBackgroundParser.cs:line 74
   at bool System.Threading.ThreadPoolWorkQueue.Dispatch()