Currently, the IRemoteServiceInvoker is defined like so:
internal interface IRemoteServiceInvoker
{
ValueTask<TResult?> TryInvokeAsync<TService, TResult>(
Solution solution,
Func<TService, RazorPinnedSolutionInfoWrapper, CancellationToken, ValueTask<TResult>> invocation,
CancellationToken cancellationToken,
[CallerFilePath] string? callerFilePath = null,
[CallerMemberName] string? callerMemberName = null)
where TService : class;
}
By returning TResult?, it's impossible for a caller to tell the difference between null as a valid result and null because the remote service call failed. This issue tracks changing this method to return Optional<TResult> and updating callers to handle the result gracefully.
Alternatively, the implementation of IRemoteServiceInvoker could be changed to throw on failures rather than returning default.