Open seancpeters opened 5 years ago
Updates:
@
just after a code block.Thanks for contacting us, @seancpeters. I believe this is a known issue which is being worked on already. @NTaylorMullen can you please confirm this and if so, dupe this with the tracking issue.
Nope, not a known issue. Looks like an escaped @
transition after a @{}...
results in the @@
never showing up. This is a pretty big edgecase for normal use cases but a bug nevertheless.
@mkArtakMSFT This issue is impacting the Identity scaffolder and resulting in code that doesn't compile when using the Identity scaffolder with the Empty and Blazor Server App templates (see https://github.com/aspnet/AspNetCore/issues/11880). Can we pull this back into 3.0 and get this fixed? Or is there a recommended workaround?
Add an empty line.
Bringing this to 3.1 per https://github.com/aspnet/Scaffolding/pull/1077#issuecomment-532435528
Back to Backlog
I'm experiencing this issue both with .Net Core 3.1 and .Net 5.0.
Code to reproduce the issue:
<p>
@{
//do stuff
}
@@keyframes pulse {
0% {
background-color: #001f3f;
}
100% {
background-color: #ff4136;
}
}
</p>
@@keyframes is nerver rendered.
Adding an empty line after the code block doesn't work either.
Add an empty comment after the code block:
<p>
@{
//do stuff
}
@**@
@@keyframes pulse {
0% {
background-color: #001f3f;
}
100% {
background-color: #ff4136;
}
}
</p>
Thread summary:
This seems like an annoyance with a fairly simple workaround (add a new line). If a quick fix is feasible, we should consider it.
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.
Describe the bug
When processing razor content, if I include an
@@inject
immediately after a razor code block, the@@inject
is missing from the generated code.To Reproduce
Steps to reproduce the behavior:
I am using the following code to process .cshtml documents, from: https://github.com/aspnet/Scaffolding/blob/master/src/VS.Web.CG.Templating/RazorTemplating.cs
Relevant package versions:
When processing this content:
The
@@inject
statements immediately following the Razor code blocks@{}
are ignored. Note that this is a minimal repro, and in my real document, the code blocks are non-empty, but the behavior is the same.This is the resultant generated code, from generatorResults.GeneratedCode:
Note that there is no
@inject
preceding Injection_2 or Injection_4, which are the ones immediately following the code blocks.Expected behavior
All of the
@@inject
statements should be processed / included.Additional context
I believe this is a regression from previous versions. The file I noticed this issue with is: https://github.com/aspnet/Scaffolding/blob/master/src/VS.Web.CG.Mvc/Templates/Identity/Bootstrap4/_LoginPartial.cshtml
This has not changed since August 2018, and prior to the razor changes for 3.x, the @@inject statements were processed as expected.
Including the output of
dotnet --info
, but don't think it's relevant here: