{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/19829","repository_url":"https://api.github.com/repos/dotnet/roslyn","labels_url":"https://api.github.com/repos/dotnet/roslyn/issues/19829/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/roslyn/issues/19829/comments","events_url":"https://api.github.com/repos/dotnet/roslyn/issues/19829/events","html_url":"https://github.com/dotnet/roslyn/issues/19829","id":231852478,"number":19829,"title":"pathmap command line option inconsistent with similar command line options such as link/reference with regards to paths containing spaces","user":{"login":"jeffanders","id":13701677,"avatar_url":"https://avatars0.githubusercontent.com/u/13701677?v=3","gravatar_id":"","url":"https://api.github.com/users/jeffanders","html_url":"https://github.com/jeffanders","followers_url":"https://api.github.com/users/jeffanders/followers","following_url":"https://api.github.com/users/jeffanders/following{/other_user}","gists_url":"https://api.github.com/users/jeffanders/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffanders/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffanders/subscriptions","organizations_url":"https://api.github.com/users/jeffanders/orgs","repos_url":"https://api.github.com/users/jeffanders/repos","events_url":"https://api.github.com/users/jeffanders/events{/privacy}","received_events_url":"https://api.github.com/users/jeffanders/received_events","type":"User","site_admin":false},"labels":[{"id":166673288,"url":"https://api.github.com/repos/dotnet/roslyn/labels/Area-Compilers","name":"Area-Compilers","color":"5319e7","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/dotnet/roslyn/milestones/29","html_url":"https://github.com/dotnet/roslyn/milestone/29","labels_url":"https://api.github.com/repos/dotnet/roslyn/milestones/29/labels","id":2377970,"number":29,"title":"15.later","description":"A release after 15.3","creator":{"login":"jaredpar","id":146967,"avatar_url":"https://avatars3.githubusercontent.com/u/146967?v=3","gravatar_id":"","url":"https://api.github.com/users/jaredpar","html_url":"https://github.com/jaredpar","followers_url":"https://api.github.com/users/jaredpar/followers","following_url":"https://api.github.com/users/jaredpar/following{/other_user}","gists_url":"https://api.github.com/users/jaredpar/gists{/gist_id}","starred_url":"https://api.github.com/users/jaredpar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaredpar/subscriptions","organizations_url":"https://api.github.com/users/jaredpar/orgs","repos_url":"https://api.github.com/users/jaredpar/repos","events_url":"https://api.github.com/users/jaredpar/events{/privacy}","received_events_url":"https://api.github.com/users/jaredpar/received_events","type":"User","site_admin":false},"open_issues":657,"closed_issues":30,"state":"open","created_at":"2017-03-10T17:35:36Z","updated_at":"2017-06-06T00:23:55Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2017-05-28T07:34:32Z","updated_at":"2017-06-07T05:40:06Z","closed_at":null,"body":"Pathmap is fairly new and as of yet undocumented compiler command line option (see #18071 and dotnet/docs#1800). The main purpose of pathmap is to remap paths of source files for the benefit of deterministic builds that use CallerFilePathAttribute.\r\n\r\nThe general format of the pathmap command line option is:\r\n/pathmap:path1=pathA,path2=pathB etc\r\n\r\nIf any of the paths provided to the pathmap parameter contain spaces then you need to put double quotes around the entire set of comma separated path mapping instead of being able to quote individual paths. \r\n\r\nParsePathMap is inconsistent with other command line options that take a comma separated list of files or paths. For example the link and reference command line options make use of ParseAssemblyReferences which gives the following examples in comments within that method:\r\n\r\n// /r:\"reference\"\r\n// /r:alias=reference\r\n// /r:alias=\"reference\"\r\nThe MSDN documentation for the link option (https://msdn.microsoft.com/en-us/library/dd264728.aspx) explicitly states \"If the file name contains a space, enclose the name in quotation marks\".\r\n\r\nIt is expected that pathMap should work in a similar way.\r\n\r\n**Version Used**: \r\nThis is using latest Master. I actually came across this while updating all Roslyn tests to be compatible with user accounts/temp paths containing spaces.  Please refer to pull request #17524 for further details.\r\n\r\n**Steps to Reproduce**:\r\n\r\n1. Create a new folder containing a space, for example \"c:\\path with spaces\" and create a program.cs file in that folder with the following contents:\r\n``` C#\r\nusing System;\r\n\r\nclass Program\r\n{\r\n    static void Main(string[] args) => TraceMessage();\r\n    static void TraceMessage([System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath = \"\") => Console.WriteLine(\"source file path: \" + sourceFilePath);\r\n}\r\n```\r\n2. Compile the project from the command line as follows:\r\n```csc.exe program.csc /pathmap:\"c:\\path with spaces\"=\\ ```\r\n3. Run program.exe\r\n\r\n**Expected Behavior**:\r\nProduce a program.exe that when run produces the following output:\r\n```source file path: c:\\path with spaces\\program.cs\"```\r\n\r\n**Actual Behavior**:\r\ncsc.exe returns an error because the command line was malformed with everything from the word ```with``` onwards being treated as extra separate command line options. The error returned is:\r\n```error CS8101: The pathmap option was incorrectly formatted.```\r\n\r\nTo successfully compile this with the pathmap you must use the following command line (note the closing double quote is now after the forward slash after the equals sign):\r\n```csc.exe program.csc /pathmap:\"c:\\path with spaces=\\\" ```"},"comment":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/comments/306692167","html_url":"https://github.com/dotnet/roslyn/issues/19829#issuecomment-306692167","issue_url":"https://api.github.com/repos/dotnet/roslyn/issues/19829","id":306692167,"user":{"login":"jcouv","id":12466233,"avatar_url":"https://avatars1.githubusercontent.com/u/12466233?v=3","gravatar_id":"","url":"https://api.github.com/users/jcouv","html_url":"https://github.com/jcouv","followers_url":"https://api.github.com/users/jcouv/followers","following_url":"https://api.github.com/users/jcouv/following{/other_user}","gists_url":"https://api.github.com/users/jcouv/gists{/gist_id}","starred_url":"https://api.github.com/users/jcouv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jcouv/subscriptions","organizations_url":"https://api.github.com/users/jcouv/orgs","repos_url":"https://api.github.com/users/jcouv/repos","events_url":"https://api.github.com/users/jcouv/events{/privacy}","received_events_url":"https://api.github.com/users/jcouv/received_events","type":"User","site_admin":false},"created_at":"2017-06-07T05:40:06Z","updated_at":"2017-06-07T05:40:06Z","body":"Ping @TyOverby @gafter "}}
{"actor":{"display_login":"jcouv"}}