-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Discussion: mandatory partial methods #753
Comments
Using the |
Calling such methods would fail at runtime. So you should either provide an implementation (as proposed here) or add the attribute. Not sure if it already has any legitimate use cases outside DllImport. Regarding backward compat I think this is similar to dotnet/roslyn#8456, so perhaps these could be resolved similarly. (note: that issue doesn't even produce a warning). |
Furthermore, with an implementation, the warning would go away. you could opt-in to make that an error. |
Remoting. I've used this feature myself to declare client versions of server objects where the implementations are furnished at runtime, either by remoting or through my own code. For fun I've even abused IIRC, mscorlib also declares various methods as |
Also |
So I think we're left with a couple of options,
|
🍝 I might propose the following alternatives:
|
This was discussed under source generators, but it is still useful with current code generation mechanisms,
We can relax
partial
method restrictions and make that a mandatory partial method.Open question: How could we define a private mandatory partial method? Currently
private partial
is not permitted but since the default modifier isprivate
that could lead to confusion.(edited to use
partial
instead ofextern
to reflect the discussion below)The text was updated successfully, but these errors were encountered: