Skip to content
This repository was archived by the owner on Dec 19, 2018. It is now read-only.

Imported @page directive should log a diagnostic. #1503

Closed
NTaylorMullen opened this issue Jul 3, 2017 · 3 comments
Closed

Imported @page directive should log a diagnostic. #1503

NTaylorMullen opened this issue Jul 3, 2017 · 3 comments
Assignees
Milestone

Comments

@NTaylorMullen
Copy link
Contributor

Today if you import an @page directive you end up with Razor thinking a view is a "page" but then MVC doesn't detect that. We should log a diagnostic indicating that imported @page directives are invalid.

@pranavkm
Copy link
Contributor

pranavkm commented Jul 3, 2017

Couldn't we make it so that @page does not get imported?

@NTaylorMullen
Copy link
Contributor Author

@pranavkm You could but then you'd have silent errors in the system. I'd rather let it be imported and indicate that it's an error when a user attempts to use that imported view.

NTaylorMullen added a commit that referenced this issue Jul 3, 2017
- Prior to this imported `@page` directives would flow through the Razor system without error. This resulted in inconsistent behavior between MVC and Razor. Now, imported `@page` directives result in diagnostics on the page directive node.
- Added two tests to verify that we still treat views with imported page directives as Razor pages BUT we also log a diagnostic on the page directive node.
- Renamed the `ViewComponentDiagnosticFactory` class to `RazorExtensionsDiagnosticFactory` so it can be used for more than just view component diagnostics. This way we can ensure that our diagnostics don't end up overlapping.

#1503
NTaylorMullen added a commit that referenced this issue Jul 4, 2017
- Prior to this imported `@page` directives would flow through the Razor system without error. This resulted in inconsistent behavior between MVC and Razor. Now, imported `@page` directives result in diagnostics on the page directive node.
- Added two tests to verify that we still treat views with imported page directives as Razor pages BUT we also log a diagnostic on the page directive node.
- Renamed the `ViewComponentDiagnosticFactory` class to `RazorExtensionsDiagnosticFactory` so it can be used for more than just view component diagnostics. This way we can ensure that our diagnostics don't end up overlapping.

#1503
NTaylorMullen added a commit that referenced this issue Jul 4, 2017
- Prior to this imported `@page` directives would flow through the Razor system without error. This resulted in inconsistent behavior between MVC and Razor. Now, imported `@page` directives result in diagnostics on the page directive node.
- Added two tests to verify that we still treat views with imported page directives as Razor pages BUT we also log a diagnostic on the page directive node.
- Renamed the `ViewComponentDiagnosticFactory` class to `RazorExtensionsDiagnosticFactory` so it can be used for more than just view component diagnostics. This way we can ensure that our diagnostics don't end up overlapping.

#1503
@NTaylorMullen
Copy link
Contributor Author

d36838e

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

No branches or pull requests

2 participants