mirror of
https://github.com/VSadov/Satori.git
synced 2025-06-08 11:37:04 +09:00
Clean up aspnetcore
casing in ref to that repo (#47347)
- address difference I introduced in dotnet/aspnetcore#29511 and more - conflict detected in dotnet/aspnetcore#29520 - also s|aspnet/aspnetcore|dotnet/aspnetcore|
This commit is contained in:
parent
39d72d4fe7
commit
e63969dba5
7 changed files with 69 additions and 69 deletions
|
@ -67,7 +67,7 @@ However, for existing virtual APIs that do not have any such strong guarantee do
|
|||
4. How common is it in the case of (3) for such invocations to then dereference the result rather than passing it off to something else that accepts a `T?`?
|
||||
|
||||
`Object.ToString` is arguably the most extreme case. Answering the above questions:
|
||||
1. It is fairly easy in any reasonably-sized code base to find cases, intentional or otherwise, where `ToString` returns `null` in some cases (we've found examples in dotnet/corefx, dotnet/roslyn, NuGet/NuGet.Client, aspnet/AspNetCore, and so on). One of the most prevalent conditions for this are types that just return the value in a string field which may contain its default value of `null`, and in particular for structs where a ctor may not have even had a chance to run and validate an input. Guidance in the docs suggests that `ToString` shouldn't return `null` or `string.Empty`, but even the docs don't follow its own guidance.
|
||||
1. It is fairly easy in any reasonably-sized code base to find cases, intentional or otherwise, where `ToString` returns `null` in some cases (we've found examples in dotnet/corefx, dotnet/roslyn, NuGet/NuGet.Client, dotnet/aspnetcore, and so on). One of the most prevalent conditions for this are types that just return the value in a string field which may contain its default value of `null`, and in particular for structs where a ctor may not have even had a chance to run and validate an input. Guidance in the docs suggests that `ToString` shouldn't return `null` or `string.Empty`, but even the docs don't follow its own guidance.
|
||||
2. Thousands upon thousands of types we don't control override this method today.
|
||||
3. It's common for helper routines to invoke via the base `object.ToString`, but many `ToString` uses are actually on derived types. This is particularly true when working in a code base that both defines a type and consumes its `ToString`.
|
||||
4. Based on examination of several large code bases, we believe it to be relatively rare that the result of an `Object.ToString` call (made on the base) to be directly dereferenced. It's much more common to pass it to another method that accepts `string?`, such as `String.Concat`, `String.Format`, `Console.WriteLine`, logging utilities, and so on. And while we advocate that `ToString` results shouldn't be assumed to be in a particular machine-readable format and parsed, it's certainly the case that code bases do, such as using `Substring` on the result, but in such cases, the caller needs to understand the format of what's being rendered, which generally means they're working with a derived type rather than calling through the base `Object.ToString`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue