dotnet / dotnet/roslyn

[EnC] Make syntax offsets more version resilient

Open
#82,903 0 comments 0 reactions 1 assignee Claimed by @tmat View on GitHub
Area-Interactive
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

EnC uses syntax offsets to track various locations in IL that need to be mapped when deltas are emitted. This mapping requires the version of the source generators used to compile the dll to produce exactly the same source as the source generators used by the IDE to emit the change. Since we often load different version of Razor into VS than the version in the SDK the syntax offset mapping might get broken. E.g. https://github.com/dotnet/roslyn/issues/77224

To make the mapping more robust we can use the index of EnC-tracked syntax nodes instead of syntax offsets. I.e. when calculating the syntax "offset" we count the number of syntax nodes from the start of the method body and skip nodes that EnC does not care about. This would allow the source generators output to differ in nodes that are not important for EnC. It would still fail if they differ in EnC-tracked nodes. Such differences would be less frequent and can also be validated in regression tests.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.