Skip to content

Apply PR #10768 review feedback: fix Java string escaping and logging#10771

Merged
grendello merged 5 commits intomainfrom
copilot/apply-feedback-and-approved-changes
Feb 5, 2026
Merged

Apply PR #10768 review feedback: fix Java string escaping and logging#10771
grendello merged 5 commits intomainfrom
copilot/apply-feedback-and-approved-changes

Conversation

Copy link
Contributor

Copilot AI commented Feb 4, 2026

Applies unresolved review feedback and approved suggestions from PR #10768 backport to the main branch.

Changes

  • EnvironmentBuilder.cs: Fix ValidAssemblerString to escape backslashes before double quotes. Values like path\to\file would generate invalid Java: "path\to\file" instead of "path\\to\\file".
// Before: only escapes quotes
s.Replace ("\"", "\\\"")

// After: escapes backslashes first, then quotes  
s.Replace ("\\", "\\\\").Replace ("\"", "\\\"")
  • NativeAotEnvironmentVars.java: Include exception in error log for debugging when Os.setenv fails.

  • EnvironmentHelper.cs: Add missing $ for string interpolation in assert message.

  • .gitignore: Exclude generated gradle wrapper files in src/ and tests/ directories.

Original prompt

/task can you apply this feedback to the main branch:

#10768 (comment)

Also the approved changes here:

7822edc


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits February 4, 2026 22:31
…gging, and format string

Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Copilot AI changed the title [WIP] Apply feedback and approved changes to main branch Apply PR #10768 review feedback: fix Java string escaping and logging Feb 4, 2026
Copilot AI requested a review from jonathanpeppers February 4, 2026 22:33
Remove gradle and proguard-related files from .gitignore.
@jonathanpeppers jonathanpeppers marked this pull request as ready for review February 4, 2026 22:43
Copilot AI review requested due to automatic review settings February 4, 2026 22:43
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR applies review feedback from the backport PR #10768 to the main branch, addressing three improvements to the NativeAOT environment variable handling:

Changes:

  • Fixed Java string escaping in EnvironmentBuilder.cs to properly escape backslashes before quotes, preventing invalid Java string literals
  • Added missing $ prefix for string interpolation in a test assertion message in EnvironmentHelper.cs
  • Enhanced error logging in NativeAotEnvironmentVars.java to include exception details when environment variable setting fails

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/Xamarin.Android.Build.Tasks/Utilities/EnvironmentBuilder.cs Fixes ValidAssemblerString to escape backslashes before quotes, ensuring environment variable values with backslashes generate valid Java string literals
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/EnvironmentHelper.cs Adds missing $ to enable string interpolation in an assert message
src/Xamarin.Android.Build.Tasks/Resources/NativeAotEnvironmentVars.java Adds exception parameter to Log.e() call for better debugging information

@grendello
Copy link
Contributor

The only failed test is an exceeded time in the Android resource change unit test, unrelated to this PR.

@grendello grendello merged commit 40dcdcb into main Feb 5, 2026
12 of 13 checks passed
@grendello grendello deleted the copilot/apply-feedback-and-approved-changes branch February 5, 2026 08:38
jonathanpeppers pushed a commit that referenced this pull request Feb 5, 2026
…bles support code (#10771)

This PR applies review feedback from the backport PR #10768 to the main branch, addressing three improvements to the NativeAOT environment variable handling:

**Changes:**
- Fixed Java string escaping in `EnvironmentBuilder.cs` to properly escape backslashes before quotes, preventing invalid Java string literals
- Added missing `$` prefix for string interpolation in a test assertion message in `EnvironmentHelper.cs`
- Enhanced error logging in `NativeAotEnvironmentVars.java` to include exception details when environment variable setting fails
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants