-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
First-chance exceptions when writing UsedReferences.log #89
Comments
If I understand correctly this is writing to the file which was passed as an additional file to the analyzer. Unfortunately this is problematic as it can lead to problems with analyzers rerunning when the file has changed. Roslyn workspace monitors all files that are input to the compilation for changes on disk, and when they change it retriggers analyzers to feed them the latest inputs. When you write to an input file Roslyn workspace may see this change and if it happens outside the throttling window it will retrigger the analyzer. In general I understand why this is designed as an analyzer (to tap into the Roslyn world to get the accurate info about references), however it's perhaps undesirable that this runs pretty much on every keystroke in the IDE. Is this an incremental analyzer? |
Interesting. This issue was likely introduced in #81. This is not really intended to be an incremental analyzer. I would not mind if we only ran it on "real" builds. Do you know if there is an easy way to detect this? |
yes, it feels like this should be a command-line/batch tool, not an interactive tool. Perhaps we can have it disabled by default and only add the analyzer if a property is set? and have people only set that in CI? |
as a short term workaround we can add a Mutex or a lock around File.WriteAllText and have the whole thing in a try/catch |
Fixed by #90 |
When the analyzer runs (pretty much on every keystroke) it fails with this exception because the file is locked:
The text was updated successfully, but these errors were encountered: