-
Notifications
You must be signed in to change notification settings - Fork 472
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
Default interface methods #447
Comments
I just looked into it.
(which makes sense, since default implementations aren't actually inherited by the implementing class) Interface methods with default implementation have |
The only workaround I found so far for FakeItEasy is to call the default interface method non-virtually, by emitting IL with a |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Anyway, I wonder what the correct behavior should be... |
outdated
Several times, yes. Even reinstalled the whole thing on several occasions, with no better luck on subsequent tries. There's no way on Earth that I am going to do these contortions every time I need to use VS. I'd rather stay with VS1017. 😆
I would also prefer the former, but implicit |
This may be much easier to implement than I had previously assumed. Up until now, I was mostly thinking about how to implement This reduces the problem to ensuring two things:
I'll give this a try later today. |
Hi, @stakx |
@andreminelli, yes, I have. I've so far made two separate code drafts for DIM support, however got stuck every time due to there being many use cases that all need slightly different solutions (some very easy to implement, some still very tricky), and I haven't yet figured out how to structure the PR so it makes the easiest possible changes in the most logical order for all of those cases. I've also been severely busy at work the last few months, but I may give this another go sometime in the next few months (I'm often a little less busy during spring/summertime). |
Nice. |
@andreminelli, I'll check whether I still have my old code drafts, and if so, I'll push them to my GitHub fork project and let you know here where to find them. (Just so you know what you're getting yourself into, understanding DynamicProxy's internals takes some effort... it took me roughly a year of regularly working on it to acquire a fairly complete understanding of the internal architecture. I've started a developer-oriented document describing the architecture at a high level, #624, but it's only an incomplete draft at this time.) |
Thanks for the warning, @stakx . So take your time to check your drafts 👍 |
@andreminelli, I found 3 drafts on my old laptop (here, here, and here) created at various times and with various levels of incompleteness; generally speaking, I never got very far due to interruptions, and when I picked this up again, I forgot where I had left off, so I started anew. I was never quite happy with the commit progression and the tests. Also, without checking, I believe I never got to the one use case that you care about most, because IIRC it's the trickiest one to solve, so I would have tackled that one last. |
I'm finally giving this another go, but I think for now I'll only look at inheritance-based proxy types (i. e. those without target) due to time constraints... these are likely the most important proxy types for our downstream testing libraries. |
I've merged #661 which adds support for default interface members for the most common proxy types. It is incomplete but perhaps covers the most important use cases for now. I'm going to close this issue, we can always open a new one for any important remaining use cases (proxies with target, static abstract interface methods, etc.). |
Hi @stakx, |
@thomaslevesque, you're welcome! I'm sorry that this took so long... but I needed to step away from FOSS for a while after retiring from the Moq project out of protest, several months ago. Still, I'm happy if my work here benefits downstream libraries! Version 5.2.0 indeed is not released yet like it should be, I'll need assistance from @jonorossi to get it pushed to NuGet. Shouldn't be too long now. In the meantime, feel free to test your library against DynamicProxy's current |
You have nothing to apologize for. We all have a life, and it's more important than OSS.
No problem, I'll build from source in the meantime |
Well, as far as I can tell, it "just works" in FakeItEasy, no changes needed except updating Castle.Core. I'll probably need more tests to be sure, but it looks promising! |
The upcoming .NET Core 3.0 along with C# 8 will support default interface methods.
It is likely that DynamicProxy won't support those properly (e.g.,
Proceed
?) without some changes. This is a reminder to look into this.The text was updated successfully, but these errors were encountered: