Skip to content

ParseAndCheckFileInProject may return stale results #11291

@auduchinok

Description

@auduchinok

Consider the following repro steps for project with two files:

  • Parse and check File2.fs (File1.fs is checked as a dependency, results for File1 and File2 get cached)
  • Change File1.fs and parse and check it
  • Parse and check File2.fs again, it'll have the same stamp (since its source hasn't changed), so it will use the old results

The following code uses the incremental builder cache that is seemingly never updated by the background compiler after a file check:

member _.GetCachedCheckFileResult(builder: IncrementalBuilder, filename, sourceText: ISourceText, options) =

After checking a file only background compiler caches are updated, not the incremental builder ones:

bc.RecordTypeCheckFileInProjectResults(fileName, options, parsingOptions, parseResults, fileVersion, timeStamp, Some checkAnswer, sourceText.GetHashCode())

This was discussed in #11228 (comment), but FCS 39 has different logic there, and a different fix is needed (unless the PR with the fix is merged soon and everything else is considered stable enough for a new FCS release).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-FCSBugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.Regression

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions