-
Notifications
You must be signed in to change notification settings - Fork 199
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
[VS Code] Fix project.razor.json serialization issue #8489
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As with most things, would love some sort of test for this :)
@@ -94,7 +95,8 @@ protected virtual void SerializeToFile(OmniSharpProjectSnapshot projectSnapshot, | |||
// by the time we move the tempfile into its place | |||
using (var writer = tempFileInfo.CreateText()) | |||
{ | |||
_serializer.Serialize(writer, projectSnapshot); | |||
var projectRazorJson = new ProjectRazorJson(publishFilePath, projectSnapshot.InternalProjectSnapshot); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓is there ever a time when serializing the snapshot is correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It results in a circular dependency, so I don't think so (or at least not any scenario I can think of)
src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Properties/AssemblyInfo.cs
Outdated
Show resolved
Hide resolved
src/Razor/src/Microsoft.AspNetCore.Razor.OmniSharpPlugin/DefaultProjectChangePublisher.cs
Outdated
Show resolved
Hide resolved
// Licensed under the MIT license. See License.txt in the project root for license information. | ||
|
||
using System.Runtime.CompilerServices; | ||
|
||
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Razor.OmniSharpPlugin, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should go too. Anything OmniSharpPlugin needs from this project can just be public in this project
Thanks for the reviews and feedback Andrew and David! @davidwengier could I get another look at this? |
Summary of the changes
project.razor.json
files because we were trying to serialize the project snapshot when we should have been serializing theProjectRazorJson
type. We used to do this correctly but it seems this behavior was somehow changed in External access #8046 (Ryan's parting gift to us 😄 )