closing a condition block on the last line of file fails when followed by a blank line
See original GitHub issuePart of my dotnet project template has a yml
file for which i have had to add my own SpecialCustomOperations
configuration so comments can be detected
template.json:
"SpecialCustomOperations": {
"*.yml" : {
"Operations": [
{
"type": "conditional",
"configuration": {
"style": "line",
"token": "#"
}
}
]
}
}
I have found that when an #endif
statement is on the last line of the file followed by a blank line (as posix requires) the dotnet new
operation fails to initialise the template completely. However if the file has no blank lines or more than one blank line the template is processed correctly.
my-config-file.yml:
thing:
- thing1
- thing2
##if( condition )
-- thing3
##endif
The error i get is
Template "DemoProject" could not be created.
Error while processing file /my-config-file.yml
Non-negative number required.
Parameter name: srcOffset
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Stopping condition for when the last line of a file is blank C++
From what I understand, you have something like this: std::ifstream file("file.txt"); std::string line; while(getline(file,line)) { //read ...
Read more >SyntaxError: unexpected EOF while parsing
EOF stands for "end of file," and this syntax error occurs when Python detects an unfinished statement or block of code. This can...
Read more >if / else errors - learn how to fix these
When you put a semicolon at the end of a condition, like this: if ... the `;` was the end of your if...
Read more >PSR-12: Extended Coding Style
All PHP files MUST end with a non-blank line, terminated with a single LF. ... Any closing brace MUST NOT be followed by...
Read more >block-closing-brace-empty-line-before
This rule is deprecated and will be removed in the future. See the migration guide. Require or disallow an empty line before the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fixed!
@RehanSaeed I will try to do my best to include this fix into .NET 5 release (5.0.100 mid of November). Also, feel free to join our Gitter channel, where you can ask questions like this (https://gitter.im/dotnet/templating).