Skip to content
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

[GB18030] UpToDate marker file name shortening doesn't respect surrogate chars #10066

Closed
JanKrivanek opened this issue Apr 24, 2024 · 0 comments · Fixed by #10063
Closed

[GB18030] UpToDate marker file name shortening doesn't respect surrogate chars #10066

JanKrivanek opened this issue Apr 24, 2024 · 0 comments · Fixed by #10063

Comments

@JanKrivanek
Copy link
Member

Context

#10063

Introduced by: https://github.com/dotnet/msbuild/pull/9406/files#diff-5407d46dd30ce4031e530c35cc2e0a62a6c96e54cb1def14fb316f351ef92de9R389-R395

Recommended fix

As suggested by @ladipro (https://github.com/dotnet/msbuild/pull/9406/files#diff-5407d46dd30ce4031e530c35cc2e0a62a6c96e54cb1def14fb316f351ef92de9R389-R395) we should create property function handling the string shortening

ladipro pushed a commit that referenced this issue Apr 25, 2024
Fixes #10066
[GB18030] Failed to run the WebAPI project that named as GB18030 provided level3 strings

### Context
OS: Windows 11 Enterprise 22H2 ZH-CN
Affected Build: 9.0.0-preview.4.24209.5, Aso repro on 8.0.300-preview.24203.14(8.0.2)

Steps to reproduce:

Use CLI to create WebAPI project copying GB18030 characters, for example:
```
dotnet new webapi -controllers -o 㐇𠁠𪨰𫠊𫦠𮚮⿕#
cd 㐇𠁠𪨰𫠊𫦠𮚮⿕#
dotnet run
```

Without this PR:
```
dotnet run
Building...
Restore complete (0.5s)
You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
  㐇𠁠𪨰𫠊𫦠��⿕# failed with 2 error(s) (2.9s) → bin/Debug/net9.0/㐇𠁠𪨰𫠊𫦠��⿕#.dll
    /workspaces/runtime/.dotnet/sdk/9.0.100-preview.3.24204.13/Microsoft.Common.CurrentVersion.targets(5578,5): error MSB3491: Could not write lines to file "obj/Debug/net9.0/㐇𠁠𪨰𫠊𫦠��⿕#.csproj.FileListAbsolute.txt". Unable to translate Unicode character \\uD86E at index 2368 to specified code page.
    /workspaces/runtime/.dotnet/sdk/9.0.100-preview.3.24204.13/Microsoft.Common.CurrentVersion.targets(5823,5): error MSB3491: Could not write lines to file "obj/Debug/net9.0/㐇𠁠𪨰𫠊𫦠��⿕#.csproj.FileListAbsolute.txt". Unable to translate Unicode character \\uD86E at index 2368 to specified code page.

Build failed with 2 error(s) in 3.8s

The build failed. Fix the build errors and run again.
```

With this PR:
```
dotnet run
Building...
Restore complete (0.5s)
You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
  㐇𠁠𪨰𫠊𫦠��⿕# succeeded (0.6s) → bin/Debug/net9.0/㐇𠁠𪨰𫠊𫦠��⿕#.dll

Build succeeded in 1.5s
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://localhost:5210
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
      Content root path: /workspaces/reproGB/㐇𠁠𪨰𫠊𫦠��⿕#
^Cinfo: Microsoft.Hosting.Lifetime[0]
      Application is shutting down...
```

### Changes Made
Changed the way we create a substring to prevent cutting surrogates in half.

### Testing
Added a test for new substring function.

### Regerssion
Yes, after #9346.
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 a pull request may close this issue.

1 participant