Preserve whitespace-only argument values when loading XAML (STUD-80981) - #403
Open
PavelDrg wants to merge 1 commit into
Open
Preserve whitespace-only argument values when loading XAML (STUD-80981)#403PavelDrg wants to merge 1 commit into
PavelDrg wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
PavelDrg
marked this pull request as draft
August 3, 2026 13:47
PavelDrg
marked this pull request as ready for review
August 3, 2026 14:37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
A whitespace-only value in an Invoke Workflow File argument — e.g. a single space — is silently dropped when the workflow XAML is loaded. The value reaches disk correctly as
<InArgument x:TypeArguments="x:String" xml:space="preserve"> </InArgument>, but the parser discards it on load, so the argument comes back empty and the next save persists the loss.Root cause
XamlPullParser.Logic_IsDiscardableWhitespacedecides whether whitespace-only text at the end of an element is significant. For elements with a content property it only keeps the whitespace when that property is a string or a whitespace-significant collection.InArgument<T>declares both a content property (Expression) and a type converter, so the content-property branch discards the whitespace before the type-converter branch — which would have kept it — is ever consulted. The original comment in that method already describes the intended behavior: .NET 3.0 surfaced whitespace for type-convertible content properties as long as the content property had not been set.Fix
InArgumentConverterreceives the whitespace and producesLiteral<string>with the original value.ContentPropertyAssignedflag onXamlParserFrametracks whether the current element's content property has already received content.PreviousChildTypecannot serve this purpose because the implicitEndMemberemitted after each content item resets it. The gate keeps documents with inheritedxml:space="preserve"and child-element expressions (<InArgument><VisualBasicValue/> </InArgument>) loading exactly as before.Property elements and attribute-set properties were already excluded via
ForcedToUseConstructor, and frames areReset()on recycling, so no stale state is possible.Tests
Added to
TestCases.Workflows/XamlTests.cs, running in both the JIT and AOT expression-compilation variants:Assignand come back intact — compiled only for net6.0, since the net6.0-windows test build uses the WPF System.Xaml which does not have the fixxml:space='preserve'with a child-element expression still loadsSuites run locally: TestCases.Workflows 261+255 passed, TestCases.Xaml 92+92, TestCases.Activities 770+770 — zero failures. System.Xaml.TestCases has a pre-existing compile error on develop (
XamlObjectWriterTest.cs:2129, CS1503 with recent SDKs) unrelated to this change.Jira
https://uipath.atlassian.net/browse/STUD-80981
Context: review discussion on https://github.com/UiPath/Studio/pull/29107 concluded the proper fix belongs here in the parser, where the whitespace is actually dropped, rather than in a Studio-side load repair.
🤖 Generated with Claude Code