Bug 6984 - [AST] LiteralValue of verbatim strings are missing \r\n
Summary: [AST] LiteralValue of verbatim strings are missing \r\n
Status: RESOLVED FIXED
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2012-09-07 07:33 UTC by Mike Krüger
Modified: 2012-09-14 08:01 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Mike Krüger 2012-09-07 07:33:58 UTC
Windows line endings inside verbatim strings always get converted to \n.

This may be interresting for mcs as well, that's why I report the issue - the bug is simple:

The get_char method used for reading verbatim strings automatically converts windows to unix line endings which it shouldn't do in that case.
Comment 1 Marek Safar 2012-09-13 12:28:11 UTC
I cannot reproduce it

With this sample code I get correct value on output and correct value in ParsedValue for FULL_AST both on Mac and Windows.

If you use inlined \r\n like "a<CR><LF>" you get parser error CS1010 

using System;

namespace ConsoleApplication2
{
	class Program
	{
		static void Main (string[] args)
		{
			string s = "a\r\n\r";
			Console.WriteLine (s.Length);
		}
	}
}
Comment 2 Mike Krüger 2012-09-13 12:35:01 UTC
It's the LiteralValue of verbatim strings. you can use inlined \r\n there

string s = @"a
r";
Comment 3 Mike Krüger 2012-09-13 12:36:02 UTC
look at the get_char method & how verbatim stings are build - the literal value can't contain the \r
Comment 4 Marek Safar 2012-09-14 08:01:47 UTC
Fixed in master