Skip to content

Conversation

@allisonchou
Copy link
Contributor

Summary of the changes

  • We were throwing an exception in VS Code with project.razor.json files because we were trying to serialize the project snapshot when we should have been serializing the ProjectRazorJson 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 😄 )

@allisonchou allisonchou requested a review from a team as a code owner March 22, 2023 19:55
Copy link
Contributor

@ryzngard ryzngard left a 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 :)

using (var writer = tempFileInfo.CreateText())
{
_serializer.Serialize(writer, projectSnapshot);
var projectRazorJson = new ProjectRazorJson(publishFilePath, projectSnapshot.InternalProjectSnapshot);
Copy link
Contributor

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?

Copy link
Contributor Author

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)


using System.Runtime.CompilerServices;

[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Razor.OmniSharpPlugin, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
Copy link
Member

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

@allisonchou
Copy link
Contributor Author

Thanks for the reviews and feedback Andrew and David! @davidwengier could I get another look at this?

@allisonchou allisonchou enabled auto-merge (squash) March 23, 2023 04:18
@allisonchou allisonchou merged commit d26d207 into main Mar 23, 2023
@allisonchou allisonchou deleted the allichou/FixProjectJsonVSCode branch March 23, 2023 04:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants