Skip to content
This repository was archived by the owner on Nov 1, 2020. It is now read-only.

Overhaul ToString in the type system#5065

Merged
MichalStrehovsky merged 1 commit intodotnet:masterfrom
MichalStrehovsky:toStringOverhaul
Dec 8, 2017
Merged

Overhaul ToString in the type system#5065
MichalStrehovsky merged 1 commit intodotnet:masterfrom
MichalStrehovsky:toStringOverhaul

Conversation

@MichalStrehovsky
Copy link
Member

Fixes #1276.

This is fixing several problems with how we did ToString:

  • The existing scheme required every TypeDesc/MethodDesc/FieldDesc descendant to override ToString. Of course we were not consistent with this and as a result, most of our synthetic type system entities had non-existent representation in the debugger. Overriding is a lot of boilerplate.
  • We were not flexible with the stringified names. E.g. instantiated types became too long because we were module- and namespace- qualifying everything.
  • (Minor) The runtime type loader was shipping with ToString support in retail configuration that was largely unused.

With the new scheme, besides fixing the problems above, I'm adding a bunch of conveniences:

  • MethodDesc now also have signatures in their ToString.
  • Well-known primitive types have short aliases
  • System.Private prefix is shortened to S.P.

I tested that the TYPE_LOADER_TRACE still works after this. The runtime type loader overrides the ToString in all the places that matter.

This is fixing several problems with how we did `ToString`:
* The existing scheme required every `TypeDesc`/`MethodDesc`/`FieldDesc` descendant to override `ToString`. Of course we were not consistent with this and as a result, most of our synthetic type system entities had non-existent representation in the debugger. Overriding is a lot of boilerplate.
* We were not flexible with the stringified names. E.g. instantiated types became too long because we were module- and namespace- qualifying everything.
* (Minor) The runtime type loader was shipping with ToString support in retail configuration that was largely unused.

With the new scheme, besides fixing the problems above, I'm adding a bunch of conveniences:
* `MethodDesc` now also have signatures in their `ToString`.
* Well-known primitive types have short aliases
* System.Private prefix is shortened to S.P.

I tested that the `TYPE_LOADER_TRACE` still works after this. The runtime type loader overrides the `ToString` in all the places that matter.
@MichalStrehovsky
Copy link
Member Author

@davidwrighton @jkotas @fadimounir please take a look

@MichalStrehovsky MichalStrehovsky merged commit bcd832e into dotnet:master Dec 8, 2017
@MichalStrehovsky MichalStrehovsky deleted the toStringOverhaul branch December 8, 2017 08:47
MichalStrehovsky added a commit to MichalStrehovsky/corert that referenced this pull request Jan 19, 2018
The full `ToString` implementation includes the signature to help diagnosability, but the runtime type loader might not be able to provide that information.

Stop including MethodDesc.ToString.cs in the runtime type loader and restore old overrides on `MethodForInstantiatiatedType` and `InstantiatedMethod` that got deleted in dotnet#5065 (but only for the runtime type loader).

Also fixing up the the project file:
* The tracing options should also be available in CoreRT
* Deleting `TYPE_SYSTEM_SINGLE_THREADED` that got introduced in TFS changeset 1553623 and got never used for anything
MichalStrehovsky added a commit that referenced this pull request Jan 19, 2018
The full `ToString` implementation includes the signature to help diagnosability, but the runtime type loader might not be able to provide that information.

Stop including MethodDesc.ToString.cs in the runtime type loader and restore old overrides on `MethodForInstantiatiatedType` and `InstantiatedMethod` that got deleted in #5065 (but only for the runtime type loader).

Also fixing up the the project file:
* The tracing options should also be available in CoreRT
* Deleting `TYPE_SYSTEM_SINGLE_THREADED` that got introduced in TFS changeset 1553623 and got never used for anything
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flexible name formatting within the type system

3 participants