Skip to content
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

Catalog differences between runtime and designtime content from compiler #8202

Closed
phil-allen-msft opened this issue Feb 1, 2023 · 6 comments
Assignees
Milestone

Comments

@phil-allen-msft
Copy link
Contributor

The goal here is to, across the suite of features, understand what additional content the compiler would need to emit in order to have the runtime content power the existing IDE/tooling/designtime features.

@phil-allen-msft phil-allen-msft added this to the 17.6 P2 milestone Feb 1, 2023
@ghost ghost added the untriaged label Feb 2, 2023
@ryanbrandenburg
Copy link
Contributor

IIRC the plan here was to clone @chsienki's branch with the DesignTime stuff removed/disabled and exercise things, see where they break, by how much and we can plan further from there. @chsienki would this be that branch and is it ready for me to investigate on?

@phil-allen-msft
Copy link
Contributor Author

https://github.com/dotnet/razor/tree/features/disable-design-time is the right branch (you have it)

@phil-allen-msft phil-allen-msft modified the milestone: 17.6 P2 Feb 2, 2023
@ghost ghost removed the untriaged label Feb 2, 2023
@phil-allen-msft phil-allen-msft modified the milestones: 17.6 P2, 17.6 P3 Mar 6, 2023
@davidwengier
Copy link
Contributor

davidwengier commented Mar 20, 2023

  • Source mappings are missing for most things
  • Worth noting that tooling features are highly sensitive to exact positioning of source mappings.
    • If it turns out the whitespace differences are deliberate perf/output optimizations done by the compiler then this could be an issue. For example:
      image
      On the left, with source mapping from the above commit, various tests fail because having the caret at the < of the <br /> tag is classified as markup, not code.
  • Source mappings for attributes and attribute contents are slightly harder to add in, due to differences in code architecture, so I didn't add them.
    • For example, currenty a component like <Goo Prop="Val" /> has no generated reference to the actual property on the component that is represented by the Prop attribute. Fixing this requires generating code at runtime just to support the IDE, so we should work out a strategy for how do that in the best way.
  • It occurs to me that the number, original location, and content of source mappings should be identical between design and runtime. The order and the generated location don't need to be. Maybe its worth crafting a test that validates that specifically?
  • Various formatting behaviours depend on knowing exactly what the C# formatter does to the generated code, so will need to be adjusted.
    • This is probably a good thing, as if runtime code uses less lambdas, it should make for a better formatting experience for users
  • Some tooling tests will need to be updated because the runtime generation references more of the ASP.NET Framework, and .NET Framework, than design time. Should be irrelevant in practice in VS though.

@davidwengier
Copy link
Contributor

davidwengier commented Mar 20, 2023

No idea if it's useful, but I'm creating https://github.com/davidwengier/AllRazorAndBlazor to try to get something that has every single Razor feature in use

@phil-allen-msft phil-allen-msft modified the milestones: 17.6 P3, 17.7 P2 Apr 26, 2023
@phil-allen-msft phil-allen-msft modified the milestones: 17.8 Planning, Backlog Sep 6, 2023
@phil-allen-msft phil-allen-msft changed the title Investigate differences between runtime and designtime content from compiler Catalog differences between runtime and designtime content from compiler Jan 11, 2024
@phil-allen-msft phil-allen-msft modified the milestones: Backlog, 17.10 P1 Jan 11, 2024
@ryzngard
Copy link
Contributor

Current Status

Failed tests in CI on #9825

Integration tests run (still running) https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=8935944&view=results

Manual Testing

Small Blazor App (Release Build)

Feature Status Notes
Completion of Attribute
Completion of HTML
Completion of TagHelper
Diagnostics See (1), (2) below
FAR from .cs
FAR from .razor
GoToDef From .razor
Hover C#
Hover HTML
Hover Tag
Hover Attribute
NavBar
Rename from .cs
Rename from .razor See (3) below
Spelling ⚠️ Squiggle seems off. (4) Below

1

The #line directive end position must be greater than or equal to the start position BlazorApp1 (net6.0) C:\Users\ryzng\source\repos\BlazorApp1\BlazorApp1\Pages\FetchData.razor 30

#line (31,26)-(31,1) 25 "C:\Users\ryzng\source\repos\BlazorApp1\BlazorApp1\Pages\FetchData.razor"
__builder.AddContent(13, forecast.Date.ToShortDateString());

#line default

Steps to reproduce:

  1. Create new blazor server app
  2. Find All References onWeatherForecast from WeatherForecast.cs
  3. Open a reference in FetchData.razor

2

Missing error for missing callback. OnCopy does not exist

<button class="btn btn-primary" @onclick="IncrementCount" @oncontextmenu="OnCopy">Click me</button>

@code {
    private int currentCount = 0;

    private void IncrementCount()
    {
        currentCount++;
    }
}

3

Razor file renaming Forecast -> WeatherForecast results in
image

4

image

@phil-allen-msft
Copy link
Contributor Author

Status = Done

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

No branches or pull requests

5 participants