dotnet / dotnet/sourcelink

EmbedAllSources causes T4 sources to fail compliation

Open
#942 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
1.4k
Forks
148
PR merge metrics
No merged PRs in 30d

Description

I hope I'm reporting this in the correct repo.

We're running a project which contains TextTemplatingFilePreprocessor generations.
As we are generating a lot of code, I've added the EmbedAllSources flag to our projects and I began seeing this issue:

```
#line 1 "C:\Gitworkspace\S6_3\pc\Src\PressSDK\CodeGenerators\Press\Buzzerable\BuzzerableManagers\Templates\BuzzerableManagerInterfacesGenerator.tt"
```

For the generated files, for example:
```
///
/// Class to produce the template output
///

#line 1 "C:\Gitworkspace\S6_3\pc\Src\PressSDK\CodeGenerators\Press\Buzzerable\BuzzerableManagers\Templates\BuzzerableManagerInterfacesGenerator.tt"
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")]
public partial class BuzzerableManagerInterfacesGenerator : BuzzerableManagerInterfacesGeneratorBase
{
#line hidden
///
/// Create the template output
///
public virtual string TransformText()

```
(The issue appears for all generated files' line pragma)

The issue is, that we do NOT generate the files during build (as there are other bugs there :) ) meaning, we generate & TT's output generation in source control

So the problem is that the `#line` is pointing toward the last person who generated the generated file, meaning, I will not have it on my computer while building.

Without EmbedAllSources, there is no issue.

To reproduce, create any file with a `#line` pragma pointing toward an invalid path and activate the flag

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.