Skip to content
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

T4 Template Creates 100s of Empty Lines #503

Closed
tylerthardy opened this issue Feb 7, 2019 · 5 comments · Fixed by #712
Closed

T4 Template Creates 100s of Empty Lines #503

tylerthardy opened this issue Feb 7, 2019 · 5 comments · Fixed by #712

Comments

@tylerthardy
Copy link

tylerthardy commented Feb 7, 2019

Background:
Obtained PetaPoco v5.1.306 from NuGet into .NET project, but also present using files from this repo.
Bug present in v5.1.306 but not in v5.1.89.
Issue, replication, cause, and resolution listed here. (No Pull Request; can't integration test.)

Issue:
Generating Database.cs from Database.tt adds 3-4 linebreaks after each line of generated code:
image

Steps to Replicate:

  1. Use PetaPoco v5.1.306 from NuGet OR from this repo.
  2. Generate Database.cs by running Database.tt via Visual Studio.

Cause:
End-of-lines in (old) v5.1.89 have a carriage return followed by linefeed (\r\n), while the end-of-lines in v5.1.306 only have a linefeed with no carriage return (\n).
image

Resolution:
Adding a carriage return before the linefeed on every line restores the functionality of v5.1.306 to that of v5.1.89.
image

@pleb
Copy link
Member

pleb commented Feb 12, 2019

@tylerthardy thanks for the detailed explanation and discovery. Any chance you could make a PR which fixes this?

@nils-a
Copy link
Contributor

nils-a commented May 17, 2020

I can not confirm this issue still exists in the current sources. Is the issue still valid?

@pleb
Copy link
Member

pleb commented May 18, 2020

I'm not sure. I haven't used T4 templates in around 10 years, and never plan on using them again if I can help it. The T4 templates are around for people who love pain :)

@nils-a
Copy link
Contributor

nils-a commented May 18, 2020

I'd vote to close this issue, then. It's abviously fixed in current development.

@Curlack
Copy link
Contributor

Curlack commented Nov 10, 2023

Saw this one and decided to give it a go since it's up for grabs. Was able to generate the code exactly as we would manually i.e. no extra spaces or ill formatting.
Got little side tracked cause I wanted to test the code generation with a SQLite database, saw it wasn't supported, so added support. Then I fixed the whitespace and formatting inside the T4 templates...

Anyway, long story short, the diff on the PetaPoco.Core.ttinclude file looks horrible. I want to create a pull request, will this be standing in the way?

Curlack added a commit to Curlack/PetaPoco that referenced this issue Nov 11, 2023
Normalize whitespace and code formatting.
Add support for SQLite.

Closes CollaboratingPlatypus#503
Curlack added a commit to Curlack/PetaPoco that referenced this issue Nov 11, 2023
Normalize whitespace and code formatting.
Add support for SQLite.

Closes CollaboratingPlatypus#503
@pleb pleb closed this as completed in #712 Nov 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants