You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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
The text was updated successfully, but these errors were encountered: