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

TextLoader method override detection #64192

Merged
merged 6 commits into from
Nov 14, 2022

Conversation

tmat
Copy link
Member

@tmat tmat commented Sep 21, 2022

Implements TextLoader API change #63888

Implements pattern used by BCL to deprecate public abstract methods:

  • Update old method to call the new method.
  • Change abstract to virtual if needed
  • New method:
    • Use reflection to ask if the old method was overridden.
    • If it was overridden, call it, otherwise call old method.

We can still stack overflow if the old method is overridden but calls the base implementation.

@tmat tmat force-pushed the TextLoaderWorkspaceOverrides branch from d1379d6 to 55ee1a1 Compare September 21, 2022 21:03
@tmat tmat marked this pull request as ready for review September 21, 2022 23:22
@tmat tmat requested a review from a team as a code owner September 21, 2022 23:22
@tmat
Copy link
Member Author

tmat commented Sep 21, 2022

@tmat tmat changed the title Text loader workspace overrides TextLoader method override detection Sep 21, 2022
@AlekseyTs
Copy link
Contributor

Done with review pass (commit 1)

@tmat tmat force-pushed the TextLoaderWorkspaceOverrides branch from 609e19e to afe166a Compare September 23, 2022 16:36
@tmat tmat requested review from a team as code owners September 23, 2022 16:36
Copy link
Member

@333fred 333fred left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done review pass (commit 2)

@AlekseyTs
Copy link
Contributor

Done with review pass (commit 1 vs. 2)

@tmat tmat force-pushed the TextLoaderWorkspaceOverrides branch from b85b3cf to 2ee95a9 Compare September 26, 2022 20:48
@tmat tmat force-pushed the TextLoaderWorkspaceOverrides branch from 2ee95a9 to ce543d2 Compare September 26, 2022 21:52
@AlekseyTs
Copy link
Contributor

Done with review pass (commit 5)

@tmat tmat changed the base branch from main to release/dev17.4 September 27, 2022 03:26
@tmat tmat changed the base branch from release/dev17.4 to main September 29, 2022 20:14
@tmat tmat force-pushed the TextLoaderWorkspaceOverrides branch from b56cf4b to 50515cd Compare October 10, 2022 19:31
@build-analysis build-analysis bot mentioned this pull request Oct 10, 2022
2 tasks
@tmat tmat force-pushed the TextLoaderWorkspaceOverrides branch from bbbc5a0 to f44d8af Compare October 13, 2022 16:56
@tmat
Copy link
Member Author

tmat commented Oct 19, 2022

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 4 pipeline(s).

Copy link
Contributor

@AlekseyTs AlekseyTs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (commit 5)

@@ -88,6 +88,7 @@ private protected virtual SourceText CreateText(Stream stream, LoadTextOptions o
EncodedStringText.Create(stream, DefaultEncoding, checksumAlgorithm: options.ChecksumAlgorithm);
#pragma warning restore

[Obsolete("Use/override LoadTextAndVersionAsync(LoadTextOptions, CancellationToken)")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider explicitly specifying that this is a warning.

/// <summary>
/// Options used to load <see cref="SourceText"/>.
/// </summary>
public readonly struct LoadTextOptions : IEquatable<LoadTextOptions>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a particular reason not to use a record struct here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a particular reason not to use a record struct here?

Yes, it generates a lot of things that we don't want

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it does here. We seem to be very intentionally using all those things.

@tmat tmat force-pushed the TextLoaderWorkspaceOverrides branch from 97d7a5e to d405cd6 Compare November 10, 2022 22:45
@tmat tmat enabled auto-merge (squash) November 10, 2022 22:46
@tmat tmat merged commit b664da3 into dotnet:main Nov 14, 2022
@ghost ghost added this to the Next milestone Nov 14, 2022
@tmat tmat deleted the TextLoaderWorkspaceOverrides branch November 15, 2022 01:11
@allisonchou allisonchou modified the milestones: Next, 17.5 P2 Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants