tag:help.appveyor.com,2012-11-13:/discussions/problems/3954-test-failure-cause-by-different-newlinesAppVeyor: Discussion 2018-10-19T08:17:42Ztag:help.appveyor.com,2012-11-13:Comment/388871522016-01-11T11:59:36Z2016-01-11T11:59:37ZTest failure cause by different newlines<div><p>I am developing a <a href="https://github.com/Giorgi/Entity-Framework-Analyzers/blob/master/EntityFrameworkAnalyzers/EntityFrameworkAnalyzers/UseIncludeWithLambdaAnalyzerCodeFixProvider.cs">
Visual Studio code fix provider based on Roslyn</a> which changes
source code to avoid a hard coded. I also have one test which is
failing in appveyour but passes locally. Test fails with the
following message:</p>
<pre>
<code>Expected string to be equivalent to
"using System.Data.Entity;\n\nnamespace ConsoleApplication1\n{\n class TypeName\n {\n public void Test()\n {\n var model = new Model();\n var query = model.Salesmen.Include(a => a.Orders);\n }\n }\n}" with a length of 238, but
"using System.Data.Entity;\r\n\r\nnamespace ConsoleApplication1\n{\n class TypeName\n {\r\n public void Test()\n {\n var model = new Model();\n var query = model.Salesmen.Include(a => a.Orders);\n }\r\n }\n}" has a length of 242.</code>
</pre>
<p>Is there any configuration setting on server which causes
carriage returns to be generates in the resulting source code?</p></div>Giorgitag:help.appveyor.com,2012-11-13:Comment/388871522016-01-11T18:16:02Z2016-01-11T18:16:02ZTest failure cause by different newlines<div><p>This might be git modifying new lines (though it must be
disabled globally on build workers).</p>
<p>Try adding this to your appveyor.yml:</p>
<pre>
<code>init:
- git config --global core.autocrlf false</code>
</pre>
<p>Also, make sure what settings do you have on repo level.</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/388871522016-01-11T18:57:30Z2016-01-11T18:57:30ZTest failure cause by different newlines<div><p>Can you clarify what you mean by settings on the repo level?</p>
<p>I don't think it is related to git because carriage returns only
exist in the source code that is generated at runtime by
roslyn.</p></div>Giorgitag:help.appveyor.com,2012-11-13:Comment/388871522016-01-11T19:02:46Z2016-01-11T19:02:46ZTest failure cause by different newlines<div><p>So, you mean Roslyn generates code differently on your local
machine and build worker? I've never worked with Roslyn, but I
doubt there is a server-wide setting controlling new lines.</p>
<p>Can you do a public repo with few lines of code reproducing the
issue?</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/388871522016-01-11T19:06:27Z2016-01-11T19:06:27ZTest failure cause by different newlines<div><p>The repo is already public.</p>
<p>Basically what I am doing is I give a code to roslyn and it runs
a code fix provider (written by me) which fixes the code but the
resulting code does not match what I expect (The resulting code has
some extra carriage returns)</p></div>Giorgitag:help.appveyor.com,2012-11-13:Comment/388871522016-01-11T19:08:15Z2016-01-11T19:08:15ZTest failure cause by different newlines<div><p>What's AppVeyor project URL?</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/388871522016-01-11T19:09:10Z2016-01-11T19:09:10ZTest failure cause by different newlines<div><p><a href="https://ci.appveyor.com/project/Giorgi/entity-framework-analyzers">
https://ci.appveyor.com/project/Giorgi/entity-framework-analyzers</a></p></div>Giorgitag:help.appveyor.com,2012-11-13:Comment/388871522016-01-11T19:20:59Z2016-01-11T19:20:59ZTest failure cause by different newlines<div><p>Thanks, will take a look.</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/388871522016-01-12T02:16:23Z2016-01-12T02:16:23ZTest failure cause by different newlines<div><p>Roslyn - is it a part of .NET framework or it's something
entirely installed with Nuget?</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/388871522016-01-12T02:31:02Z2016-01-12T02:31:02ZTest failure cause by different newlines<div><p>Right, git config did the trick: <a href="https://ci.appveyor.com/project/FeodorFitsner/entity-framework-analyzers/build/1.0.7">
https://ci.appveyor.com/project/FeodorFitsner/entity-framework-anal...</a></p>
<p>appveyor.yml: <a href="https://github.com/FeodorFitsner/Entity-Framework-Analyzers/blob/master/appveyor.yml">
https://github.com/FeodorFitsner/Entity-Framework-Analyzers/blob/ma...</a></p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/388871522016-01-12T07:42:00Z2016-01-12T07:42:00ZTest failure cause by different newlines<div><p>Thanks a lot.</p></div>Giorgi