-
Notifications
You must be signed in to change notification settings - Fork 199
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
Line pragma assertions fail in design time #10981
Comments
|
Another example (with the changes in my [IntegrationTestFact]
public void AfterTag()
{
var generated = CompileToCSharp("""
@{
<div>
#if true
<div>
}
@{
#endif
}
""");
AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
if (!DesignTime)
{
// https://github.com/dotnet/razor/issues/10981
AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
}
CompileToAssembly(generated,
// x:\dir\subdir\Test\TestComponent.cshtml(7,1): error CS1028: Unexpected preprocessor directive
// #endif
Diagnostic(ErrorCode.ERR_UnexpectedDirective, "#endif").WithLocation(7, 1));
}
|
@333fred Yep, I've come accross this before. We actually added the assertion as part of fuse to make sure we didn't miss anything and at the time it held true for design time. As we've added tests we've started seeing places it no longer holds for design time. I don't think its worth altering the design time code to fix it. In #10907 I added a flag that lets you skip these asserts for design time: Lines 5595 to 5596 in ef8467d
|
* Add new preprocessor tests for the old parser, and copy their baselines over to the new parser for comparison. * Add line whitespace tracking for erroring when a preprocessor token isn't the first thing on a line. * Add initial support for parsing directives in the new lexer. * Initial work on plumbing through parser changes to correctly support directives. Many more tests are required. * Add more tests for other control flow blocks * Several misc refactors * Error on def and undef * Start testing beginning-of-line enforcement. * Report a warning when we see potential misplaced directives in disabled text. * Add more tests, include the correct location in warnings. * Usings, recomment GenerateBaselines * Nullable annotations * Update baselines, skip design time verification where tracked by #10981. * Feedback. * More feedback.
Consider this test:
After generating the baselines, this test will fail to validate line pragmas; no line pragmas will generate for any of the 4 source mappings in design time. Given our move to FUSE, I'm unsure whether this is actually important to solve, or whether it indicates that we may have a test gap in our FUSE generation. @chsienki for thoughts.
The text was updated successfully, but these errors were encountered: