OmniSharp / omnisharp-roslyn

OmniSharp server (HTTP, STDIO) based on Roslyn workspaces
MIT License
1.78k stars 419 forks source link

Razor page errors cause projects to not load #2082

Open 333fred opened 3 years ago

333fred commented 3 years ago

Make the following changes to the BasicRazorApp2_1 test in the o#-vscode repo:

  1. Change the TFM to netcoreapp3.1
  2. Remove the packagereference to Microsft.AspNetCore.App (not strictly necessary, but removes an extraneous warning with the 3.1 SDK).

O# will fail to load this project because the call to MSBuild to run Compile and CoreCompile here fails: https://github.com/OmniSharp/omnisharp-roslyn/blob/master/src/OmniSharp.MSBuild/ProjectLoader.cs#L99-L107. The specific error in this case is: Error: The 'page' directive expects a string surrounded by double quotes. Removing the invalid page from the project causes the project to be successfully loaded. Presumably, this part of the project loader is trying to validate that a design-time build can occur? Not really sure what other purpose it would have in calling those targets, but we need to do something to address the possibility of invalid razor pages on startup of the server. /cc @NTaylorMullen if you have any ideas.

NTaylorMullen commented 3 years ago

I'm surprised that this results in the project failing to load for O#. That project loader piece tries to do a separate design time build on the project which I wouldn't imagine would influence the core build scenario?

I wonder if it has to do with MSBuild's caching logic writing goodies to disk