Skip to content

Conversation

@jonpryor
Copy link
Contributor

@jonpryor jonpryor commented Dec 2, 2021

logcat-parse didn't properly deal with execution on Windows; when
specifying a Windows-style path on Windows:

> cd "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\Android"
> .\logcat-parse.exe \path\to\my\grefs.txt
var grefs = Grefs.Parse("\path\to\my\grefs.txt");
(1,52): error CS1009: Unrecognized escape sequence `\p'
(1,60): error CS1009: Unrecognized escape sequence `\m'
(1,63): error CS1009: Unrecognized escape sequence `\g'

logcat-parse could still be used, but you'd either have to use /
instead of \, or invoke logcat-parse from where grefs.txt is:

> cd \path\to\my
> "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\Android\logcat-parse.exe" ^
  grefs.txt
// `adb logcat` GREF parsing utility
//
// Use `Grefs.Parse(stream)` to parse a file containing `adb logcat` output.
// Grefs.AllocatedPeers contains all exposed Java.Lang.Object instances.
// Grefs.AlivePeers contains those still alive by the end of parsing.
var grefs = Grefs.Parse("grefs.txt");
Mono C# Shell, type "help;" for help

Enter statements below.
csharp>

Fix logcat-parse so that C# verbatim strings are used:

> "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\Android\logcat-parse.exe" ^
  \path\to\my\grefs.txt
…
var grefs = Grefs.Parse(@"\path\to\my\grefs.txt");

This allows straightforward usage on Windows.

`logcat-parse` didn't properly deal with execution on Windows; when
specifying a Windows-style path on Windows:

	> cd "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\Android"
	> .\logcat-parse.exe \path\to\my\grefs.txt
	var grefs = Grefs.Parse("\path\to\my\grefs.txt");
	(1,52): error CS1009: Unrecognized escape sequence `\p'
	(1,60): error CS1009: Unrecognized escape sequence `\m'
	(1,63): error CS1009: Unrecognized escape sequence `\g'

`logcat-parse` could still be used, but you'd either have to use `/`
instead of `\`, or invoke `logcat-parse` from where `grefs.txt` is:

	> cd \path\to\my
	> "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\Android\logcat-parse.exe" ^
	  grefs.txt
	// `adb logcat` GREF parsing utility
	//
	// Use `Grefs.Parse(stream)` to parse a file containing `adb logcat` output.
	// Grefs.AllocatedPeers contains all exposed Java.Lang.Object instances.
	// Grefs.AlivePeers contains those still alive by the end of parsing.
	var grefs = Grefs.Parse("grefs.txt");
	Mono C# Shell, type "help;" for help

	Enter statements below.
	csharp>

Fix `logcat-parse` so that [C# verbatim strings][0] are used:

	> "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\Android\logcat-parse.exe" ^
	  \path\to\my\grefs.txt
	…
	var grefs = Grefs.Parse(@"\path\to\my\grefs.txt");

This allows straightforward usage on Windows.

[0]: https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/strings/#regular-and-verbatim-string-literals
@jonpryor jonpryor merged commit 7f55b2d into dotnet:main Dec 2, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Apr 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants