Skip to content

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

Merged
grendello merged 5 commits into
mainfrom
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 into
mainfrom
copilot/apply-feedback-and-approved-changes

Conversation

CopilotAI commented Feb 4, 2026

Copy link
Copy Markdown
Contributor

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 quotess.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.

CopilotAIand 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>
CopilotAI changed the title [WIP] Apply feedback and approved changes to main branchApply PR #10768 review feedback: fix Java string escaping and loggingFeb 4, 2026
Remove gradle and proguard-related files from .gitignore.
@jonathanpeppers
jonathanpeppers marked this pull request as ready for review February 4, 2026 22:43
CopilotAI review requested due to automatic review settings February 4, 2026 22:43

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

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.

FileDescription
src/Xamarin.Android.Build.Tasks/Utilities/EnvironmentBuilder.csFixes 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.csAdds missing $ to enable string interpolation in an assert message
src/Xamarin.Android.Build.Tasks/Resources/NativeAotEnvironmentVars.javaAdds exception parameter to Log.e() call for better debugging information

@grendello

Copy link
Copy Markdown
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 mainFeb 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
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Mar 7, 2026
Sign up for freeto 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.

4 participants

@grendello@jonathanpeppers