From 789a8f5fdc4eccfeb774568062ce338df4507ac7 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Fri, 10 Aug 2012 15:56:52 +0200 Subject: [PATCH] Avoid re-using cached parse information when parsing the project after a debug/release switch. --- .../Base/Project/Src/Services/ParserService/IParserService.cs | 4 +++- .../Project/Src/Services/ParserService/ParseProjectContent.cs | 3 +++ src/Main/SharpDevelop/Parser/ParserServiceEntry.cs | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Main/Base/Project/Src/Services/ParserService/IParserService.cs b/src/Main/Base/Project/Src/Services/ParserService/IParserService.cs index 7257389ffc..7a59cb05aa 100644 --- a/src/Main/Base/Project/Src/Services/ParserService/IParserService.cs +++ b/src/Main/Base/Project/Src/Services/ParserService/IParserService.cs @@ -242,8 +242,10 @@ namespace ICSharpCode.SharpDevelop.Parser bool HasParser(FileName fileName); /// - /// Clears the cached parse information. + /// Clears the cached parse information for the specified file. /// If the file does not belong to any project, this also clears the cached type system. + /// If the file belongs to a project, the cached type system is kept (so that the classes don't go missing from the project), + /// but the next ParseFile() call will cause it to be reparsed even if it is unchanged. /// void ClearParseInformation(FileName fileName); diff --git a/src/Main/Base/Project/Src/Services/ParserService/ParseProjectContent.cs b/src/Main/Base/Project/Src/Services/ParserService/ParseProjectContent.cs index 1fa30a4636..bd3d8e277d 100644 --- a/src/Main/Base/Project/Src/Services/ParserService/ParseProjectContent.cs +++ b/src/Main/Base/Project/Src/Services/ParserService/ParseProjectContent.cs @@ -358,6 +358,9 @@ namespace ICSharpCode.SharpDevelop.Parser CancellationToken = progressMonitor.CancellationToken }, fileName => { + // Clear cached parse information so that the file is forced to be reparsed even if it is unchanged + parserService.ClearParseInformation(fileName); + ITextSource content = finder.Create(fileName); if (content != null) { parserService.ParseFile(fileName, content, project); diff --git a/src/Main/SharpDevelop/Parser/ParserServiceEntry.cs b/src/Main/SharpDevelop/Parser/ParserServiceEntry.cs index 5f8e6454ed..90052496d1 100644 --- a/src/Main/SharpDevelop/Parser/ParserServiceEntry.cs +++ b/src/Main/SharpDevelop/Parser/ParserServiceEntry.cs @@ -119,6 +119,8 @@ namespace ICSharpCode.SharpDevelop.Parser entries[i] = new ProjectEntry(oldEntry.Project, oldEntry.UnresolvedFile, null); } } + // force re-parse on next ParseFile() call even if unchanged + this.currentVersion = null; } }