Skip to content

Stepping into JADNC source does not work for Annotations package #1199

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

Closed
bkoelman opened this issue Oct 3, 2022 · 0 comments · Fixed by #1197
Closed

Stepping into JADNC source does not work for Annotations package #1199

bkoelman opened this issue Oct 3, 2022 · 0 comments · Fixed by #1197
Labels

Comments

@bkoelman
Copy link
Member

bkoelman commented Oct 3, 2022

The video below shows how stepping into ResourceGraph source code works, but fails when stepping into Identifiable<int>.StringId.get. For reasons unknown to me, the video tool failed to capture the context menu on right-click, where I selected "step into specific" to step into the .StringId getter.

JsonApiDotNetCoreWebApi1.Debugging.-.Microsoft.Visual.Studio.Preview.2022-10-03.23-31-16.mp4

This is because Microsoft.SourceLink.GitHub (which enables to download sources from GitHub and step into) is missing in the list of package references in JsonApiDotNetCore.Annotations.csproj.

For reference, the source code from the video, in case it's hard to read:

using System.Collections;
using JsonApiDotNetCore.Configuration;
using JsonApiDotNetCore.Controllers;
using JsonApiDotNetCore.Services;
using JsonApiDotNetCoreWebApi1.Models;
using Microsoft.AspNetCore.Mvc;

namespace JsonApiDotNetCoreWebApi1.Controllers
{
    public class PeopleController:JsonApiController<Person,int>
    {
        private readonly IResourceGraph _resourceGraph;

        public PeopleController(IJsonApiOptions options, IResourceGraph resourceGraph, ILoggerFactory loggerFactory,
            IResourceService<Person, int> resourceService)
            : base(options, resourceGraph, loggerFactory, resourceService)
        {
            _resourceGraph = resourceGraph;
        }

        public override async Task<IActionResult> GetAsync(CancellationToken cancellationToken)
        {
            IActionResult result = await base.GetAsync(cancellationToken);

            _resourceGraph.FindResourceType(typeof(Person)); // <-- step into works

            var people = (IEnumerable<Person>)((OkObjectResult)result).Value!;
            
            foreach (Person person in people)
            {
                string? id = person.StringId; // <-- step into fails
            }

            return result;
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

1 participant