-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[sourcegen] use GetText() instead of opening files from disk (#4128)
The source generator was doing: using (var reader = File.OpenText(projItem.AdditionalText.Path)) The problem with this, is you don't actually have to hit Ctrl+S in Visual Studio to save the files. This is potentially loading stale files on disk. Instead we can use: projItem.AdditionalText.GetText().ToString(); And this will give us the string contents of the file from the in-memory Roslyn state. This might solve some of the weird issues in the IDE such as: #4098 However, I'm still able to reproduce #4098 after making this change.
- Loading branch information
1 parent
df8b1d4
commit 33e6652
Showing
1 changed file
with
64 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters