-
Notifications
You must be signed in to change notification settings - Fork 386
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
Cannot implement Option because the only constructors are internal #1889
Comments
We're trying to reduce the surface area of the API so I would want to consider a change like this carefully. I'm curious about the use case. Is there a reason that inheriting |
@jonsequitur I appreciate the response! I've written a library that provides an attribute-based framework for declaring and configuring a I agree with the original change to remove the Please let me know if you have any questions or need more info. |
Can't you use |
@KalleOlaviNiemitalo I was able to use On a separate note, I do agree with the spirit of #1638. I will look into converting my project to use source generators rather than runtime reflection for the parser configuration. |
CompletionContext has the same restriction. I think that's even worse because its derived classes are internal so users cannot implement custom |
I have exactly same problem as Tom. I have attributes which are then translated to Options and Arguments: [Command("build", Description = "Runs build process")]
public class BuildCommand
{
public int Execute(
[Argument("Project root directory")] string rootDir = ".",
[Option("Output directory", "-o")] string outDir = "Build",
[Option("Build configuration name", "-c")] string configuration = "Release",
[Option("Target operating system [default: current OS]", "--os")] string operatingSystem = null,
[Option("Solution directory")] string solutionDir = "Source",
[Option("Release directory")] string releaseDir = "Release",
[Option("A version applied to all projects")] string version = null,
[Option("A version suffix applied to all projects")] string versionSuffix = null) I just can't understand why I can't just create an Option or Argument with Type parameter. If you want it abstract - fine. Just let me create my own implementation which allow me to do this. Besides Argument have protected constructors and Option doesn't.
I'm aware of that, but I think this way of creating objects should be avoided at all costs. It's enough to say, that changes in constructor of Option will generate errors on runtime instead of compilation errors. |
A recent change in
2.0-beta4
removed the public constructors forOption
. Because the constructors are declared withinternal
accessibility, 3rd party libraries and applications can no longer extend the abstractOption
class.The following constructors should be changed to
protected
accessibility to allow custom extensions ofOption
:The text was updated successfully, but these errors were encountered: