-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Pass the temp path to DesktopStrongNameProvider ctor #72587
Merged
ToddGrun
merged 2 commits into
dotnet:main
from
ToddGrun:PassTempPathToDesktopStrongNameProviderCtor
Mar 20, 2024
Merged
Pass the temp path to DesktopStrongNameProvider ctor #72587
ToddGrun
merged 2 commits into
dotnet:main
from
ToddGrun:PassTempPathToDesktopStrongNameProviderCtor
Mar 20, 2024
Conversation
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
This addresses feedback ticket: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1950505 The underlying issue here is that the DesktopStrongNameProvider assumes it's caller will pass it a temp directory as EmitStream.CreateStream fails if the path isn't set. Jared indicated the compiler has a ban on calling Path.GetTempPath within their codebase, so it's on the caller to specify a value.
dotnet-issue-labeler
bot
added
Area-IDE
untriaged
Issues and PRs which have not yet been triaged by a lead
labels
Mar 18, 2024
jaredpar
approved these changes
Mar 18, 2024
333fred
approved these changes
Mar 18, 2024
/azp run |
Azure Pipelines successfully started running 4 pipeline(s). |
3 tasks
ToddGrun
added a commit
to ToddGrun/roslyn
that referenced
this pull request
Jun 25, 2024
Addresses dotnet#74058 LiveUnitTest team reported a fairly recent regression where Roslyn started reporting Project changed workspace events during file addition / removal. This causes the LUT window to unnecessarilly rerun tests. This regressed as part of a change I made back in March around passing in a temp path to the compiler's strong name provider, as otherwise an EmitStream call fails, breaking intellisense in projects using assembly signing. (Change here: dotnet#72587) The regression is due to me changing several callers to creating a strong name provider based on the path, instead of them all using the default instance. With the previous behavior, equality checks on these newly created StrongNameFileSystem and DesktopStrongNameProvider instances would return false, even though the temp path in the file systems were the same. It's a bit of a windy path to how this relates to the LUT window. The Roslyn ProjectSystemProject.ChangeProjectProperty call is the crux of where the issue was being exposed. UpdateProjectOptions_NoLock was calling it with a new DesktopStrongNameProvider created with the temp path as outlined above. ChangeProjectProperty checks the old value of the strong name provider against the newValue, and if they are the same, it doesn't add anything to the batched events it will later send out. However, in this case, the equality check failed, so we started sending out a project changed notification, breaking the LUT behavior. The fix here is to simply implement Equals in StrongNameFileSystem, and have DesktopStrongNameProvider use that instead of just checking for reference equality.
ToddGrun
added a commit
that referenced
this pull request
Jun 28, 2024
* Better detect equivalence in our strong name provider Addresses #74058 LiveUnitTest team reported a fairly recent regression where Roslyn started reporting Project changed workspace events during file addition / removal. This causes the LUT window to unnecessarilly rerun tests. This regressed as part of a change I made back in March around passing in a temp path to the compiler's strong name provider, as otherwise an EmitStream call fails, breaking intellisense in projects using assembly signing. (Change here: #72587) The regression is due to me changing several callers to creating a strong name provider based on the path, instead of them all using the default instance. With the previous behavior, equality checks on these newly created StrongNameFileSystem and DesktopStrongNameProvider instances would return false, even though the temp path in the file systems were the same. It's a bit of a windy path to how this relates to the LUT window. The Roslyn ProjectSystemProject.ChangeProjectProperty call is the crux of where the issue was being exposed. UpdateProjectOptions_NoLock was calling it with a new DesktopStrongNameProvider created with the temp path as outlined above. ChangeProjectProperty checks the old value of the strong name provider against the newValue, and if they are the same, it doesn't add anything to the batched events it will later send out. However, in this case, the equality check failed, so we started sending out a project changed notification, breaking the LUT behavior. The fix here is to simply implement Equals in StrongNameFileSystem, and have DesktopStrongNameProvider use that instead of just checking for reference equality.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This addresses feedback ticket: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1950505
The underlying issue here is that the DesktopStrongNameProvider assumes it's caller will pass it a temp directory, as EmitStream.CreateStream fails if the path isn't set. Jared indicated the compiler has a ban on calling Path.GetTempPath within their codebase, so it's on the caller(s) to specify a value.