Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/instructions/Razor.instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ their original sub-tree layout
`solution.GetDocumentIdsWithFilePath(filePath)` then `solution.GetAdditionalDocument(documentId)`.
- **Remote services**: Place the public stub method (calling `RunServiceAsync`) directly
above its private implementation method.
- **Runtime-declared attribute lists**: When the runtime declares a set the compiler must read
(e.g. `[EventHandler]`, `[AcceptsAssetPath]`), it applies the attributes to a public type with
a well-known name (`EventHandlers`, `AssetPathAttributes`). A `TagHelperProducer` under
`Language/TagHelpers/Producers/` keys off that type name (`IsCandidateType`) and emits carrier
`TagHelperDescriptor`s whose descriptor-level metadata carries the parsed values. A later
optimization pass reads the full discovered set via `ITagHelperFeature.GetTagHelpers()` (not the
document's in-scope tag helpers, which are namespace-scoped) and filters by metadata kind.
- **Visual Studio options**: Register Razor Advanced settings in
`Microsoft.VisualStudio.RazorExtension\UnifiedSettings\razor.registration.json`, localize
their UI text in `VSPackage.resx`, read them through `OptionsStorage`, and add remotely consumed
Expand Down
19 changes: 19 additions & 0 deletions .github/memory/testing/razor.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,22 @@ Layer-specific test guidance for Razor tooling/compiler tests under `src/Razor`.
(Cohosting architecture).
- Integration tests using `AdditionalSyntaxTrees` for tag helper discovery must
set `UseTwoPhaseCompilation => true` (see `ComponentDiscoveryIntegrationTest`).
Under two-phase compilation the `AdditionalSyntaxTrees` are compiled into a
temp assembly and added as a *reference*, so discovery sees those types as
coming from a referenced assembly (not source).
- After Razor compiler tests or their `TestFiles` change, run the complete
affected test project. A successful build does not validate embedded
baseline resources.

## Baseline (codegen) tests

- `ComponentCodeGenerationTestBase` and similar baseline tests assert generated
IR/C#/mappings against files under
`src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/<TestName>/`.
- Regenerate baselines by building/running the test project with
`/p:GenerateBaselines=true` on one CoreCLR target framework, e.g.
`dotnet test src\Razor\src\Compiler\Microsoft.AspNetCore.Razor.Language\test\Microsoft.AspNetCore.Razor.Language.UnitTests.csproj --filter FullyQualifiedName~<Name> /p:GenerateBaselines=true`.
Tests always "pass" while generating (they overwrite baselines); re-run without
the flag to actually validate, and `git diff` the `TestFiles` to review changes.
Two-phase tests can also produce `.decl.codegen.cs` / `.decl.mappings.txt`
(the declaration half) alongside the implementation and component baselines.
350 changes: 350 additions & 0 deletions docs/razor/tilde-path-expansion.md

Large diffs are not rendered by default.

Loading