• A
    Improve EvaluationContext cache invalidation · 5b08d9b3
    Andrew Casey 提交于
    Ignoring references, which are obviously the high-order bit, the old
    strategy was to confirm that the methodToken, methodVersion, and smallest
    containing scope were the same as the current context.  This had two
    problems:
    
    1) C# hoisted locals are not reflected in scopes and so we were not
    invalidating the cache when we stepped across scope boundaries in async
    and iterator methods.
    
    2) We had to access the PDB in order to check whether the cache was still
    valid (to figure out the smallest containing scope).
    
    We propose a new approach: compute the largest span around the current IL
    offset in which there are no scope boundaries (including hoisted local
    scopes).  Then, when check cache validity by doing a simple span
    containment check (plus methodToken and methodVersion, obviously).
    
    Downside 1: We need all scopes in the method, not just the containing
    ones.
    
    Downside 2: If you somehow step around a nested scope (e.g. using
    breakpoints), the new approach will invalidate the cache, whereas the old
    one did not.
    5b08d9b3
CSharpExpressionCompilerTest.csproj 6.7 KB