Skip to content

Conversation

@RikkiGibson
Copy link
Member

@RikkiGibson RikkiGibson commented Jul 17, 2025

Effect of this change is that if dotnet run-api fails we will start showing a toast to tell user to look at the C# logs, just like we would for other design time build errors.

@RikkiGibson RikkiGibson marked this pull request as ready for review July 18, 2025 21:22
@RikkiGibson RikkiGibson requested a review from a team as a code owner July 18, 2025 21:22
@RikkiGibson
Copy link
Member Author

@jasonmalinowski @dibarbet for review

/// <param name="HasLoadErrors">
/// Whether there were errors in the process of loading the project file itself.
/// When this is true, we may still want to proceed with design-time build in order to provide partial information about the project.
/// When this is false, <see cref="RemoteProjectFile.GetDiagnosticLogItemsAsync"/> also needs to be separately checked, to decide if evaluation was successful.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple things

  1. Is it not possible to have GetDiagnosticLogItemsAsync handle this internally?
  2. If we call GetDiagnosticLogItemsAsync when true, will it throw, or will it just no-op if the project failed to load?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. It may be possible but cumbersome. RemoteProjectFile today just contains an RpcClient and an int handle. It lives in a layer which is downstream from / oblivious to the "virtual project" concept.
  2. GetDiagnosticLogItems is not expected to throw regardless of the value of HasLoadErrors. Which is kinda confusing. But basically I am trying to propagate out the fact that run-api can fail, and even if things "appear to be working" with the fallback virtual project, we may still want to signal to user that something is wrong.

{
// https://github.com/dotnet/roslyn/issues/78618: falling back to this until dotnet run-api is more widely available
_logger.LogInformation($"Failed to obtain virtual project for '{documentPath}' using dotnet run-api. Falling back to directly creating the virtual project.");
_logger.LogError($"Failed to obtain virtual project for '{documentPath}' using dotnet run-api. Falling back to directly creating the virtual project.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is still only available in .net10 right, which hasn't fully released? Should this still be a warning?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes...actually, this is kinda annoying, because we probably still want to distinguish "SDK too old" cases, from "run-api is present, but its results were completely messed up". No need to report anything in the "SDK too old" case.

I will have to take a look at how to make that distinction.

@RikkiGibson RikkiGibson marked this pull request as draft July 24, 2025 16:51
protected sealed record RemoteProjectLoadResult(RemoteProjectFile ProjectFile, ProjectSystemProjectFactory ProjectFactory, bool IsMiscellaneousFile, BuildHostProcessKind Preferred, BuildHostProcessKind Actual);
/// <param name="HasLoadErrors">
/// Whether there were errors in the process of loading the project file itself.
/// When this is true, we may still want to proceed with design-time build in order to provide partial information about the project.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The semantics described here are a bit reversed of what I'd imagine we would do -- I would have expected 'true' means 'we know there are already errors, no reason to go further'.

Is the easier approach here just to return a set of diagnostics that are concatenated onto the existing things that get reported?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants