-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Try fix DataGrid HTML clipboard data faulty #10477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Try fix DataGrid HTML clipboard data faulty #10477
Conversation
LGTM, this should be backported imho. A unit test wouldn't hurt. |
I don't really like the code this has been changed to, it's too fragile and might not survive git handling of new lines. |
Thx so much - for the ultra-quick reaction to this as well as just in general for maintaining the framework. |
@miloush What do you suggest? Thank you. How about back to origin code? |
Yeah that's a good point as raw string literals always emit whatever is in the source, and there's no way to emit specific line-endings (unfortunately, the language team has not shown any traction on a proposal to handle this). @lindexi We could just use a syntax like $"abcd \r\n" +
$"xxx \r\n" +
$"xxx \r\n"; Roslyn will lower this into one interpolated handler and it will look "decent" in the code. It will emit more But a test for the method would be enough to keep using the raw string literals here (I'm a fanboy) imho. It's an internal function by design and can be easily tested. |
Follow @h3xds1nz 's suggestion.
031cfea
to
6a1975b
Compare
LGTM, even though I did like the added readability allowed by raw interpolated strings |
I'd like it too. |
@lindexi As I've said previously, why don't you just use raw-interpolated string then as previously done and write 2-3 unit tests around to verify the correct line-breaks are emitted? That way it is safe and readable. |
@h3xds1nz Thank you. I just fall back to the old code. And I do not plan to add the unit test. And we can not control the CRLF in the raw-interpolated string, so that I do not want to use the raw-interpolated string yet. And, why not I use the syntax like: $"abcd \r\n" +
$"xxx \r\n" +
$"xxx \r\n"; Because we should pass the |
Fixes #10476
Main PR
Description
The #8519 introduces behavior changed. And this pr restore the origin behavior.
The origin behavior is:
wpf/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/DataGridClipboardHelper.cs
Lines 17 to 20 in d4ffc34
But after #8519 , it is:
wpf/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/DataGridClipboardHelper.cs
Lines 83 to 113 in a792086
which wrong with double CR/LFs (
\r\n\r\n
)Customer Impact
Fixes #10476
Regression
See #8519
Testing
Only CI.
Risk
Normal. This PR will changed the DataGrid clipboard behavior.
Cc @halgab
Microsoft Reviewers: Open in CodeFlow