VerifyTests has BuildServer difference: [CallerFilePath] string? path = null

24 views Asked by At

I have a code generator that outputs various text files which includes the line:

sb.Al($"// File: {Path}, Line: {Line}");

the path segment utitilises a method parameter [CallerFilePath] string? path = null, [CallerLineNumber] int line = 0, when run locally this becomes

// File: {SolutionDirectory}src/Modeller.Templates/EntityFile.cs, Line: 29

however when I run this on a buildserver, in this case via Azure DevOps, it inserts the full working path:

// File: /home/vsts/work/1/s/src/Modeller.Templates/EntityFile.cs, Line: 29

this produces a failure in the pipeline. What is the best approach to rectify this? I see two options but I'm not sure it's the best as it changes current behaviour:

  1. Change the path value before writing the file, (don't want to do this)
  2. Create another scrubber to remove everything before the src folder, (don't really want to scrub twice).

If this line is already being scrubbed then it could be a setting I am not aware of.

1

There are 1 answers

1
Simon On

there is not enough info to diagnose this. please raise a bug here https://github.com/VerifyTests/Verify/issues