Skip to content

Fix string escaping in src/System.Private.ServiceModel/src/Resources/Strings.resx #3186

Closed
@mconnew

Description

There's a bit of history with how the strings were handled in this repo as build tools and project systems evolved. When this code base was initially created, resource strings were moved to be in a json file. There was a code generation step where the literal resource strings were read, placed into quotes and emitted into generated code. This meant that the json file needed to have the text pre-escaped for C#. An example of this is the resource string UnableToResolveHost.

<value>Cannot resolve the host name of URI \"{0}\" using DNS.</value>

As the resource value is being parsed from XML, the resulting string contains a backslash followed by a quotation mark. This escape sequence is relevant when compiling code and shouldn't be in the resultant string object. The end result will be that you will see the escape sequence in output, e.g. if an exception is thrown and not caught, when the process is exiting it writes the exception message out to console. You will see the escape sequence on the console output.

Metadata

Labels

bugThis is a product bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions