-
Notifications
You must be signed in to change notification settings - Fork 777
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
Message.Attach picks wrong method because of similar name #314
Comments
Yup, at the moment it's only looking at count of the parameters and not their types. It should be possible to do type examination. |
@nigel this would be a significant change from Caliburn's original explicit goal of keeping the Message.Attach functionality extremely limited.
|
The functionality would still be limited. Making it pick the correct method in an overload scenario would be a minor extension to prevent unexpected bugs. |
@StephenWard I don't think it's a major expansion, we won't be adding more capabilities to Thinking over this some more I believe this could be a breaking change if people are depending on the current behavior. In terms of the scenarios listed above staying away from generics is probably best but the others can be resolved by checking |
Why not use C# binder from Microsoft.CSharp.dll? It'll choose an override just like C# does. Not sure about its availability on all platforms though. |
Can you expand on that, it's nothing something I've used before. But platform availability would certainly be a concern. |
DLR is used by C# compiler to implement See Dynamitey for sample code, it includes all possible operations. It adds an extra caching level and includes workarounds for bugs (with static methods, iirc), so the code may look more complex than actually needed. Here's a very simplified code I use in a similar scenario for user-provided converters. JSON.NET uses it too, though only for getters and setters and with an additional layer of reflection over it. Considering availability of JSON.NET on many platforms, I think you can rely on its |
Thanks for that, will look it over, may be a bit of sledgehammer to crack a nut, but a definite possibility. |
Considering DLR is built-in and exactly matches behavior of C#, I don't think it qualifies as a sledgehammer. I'd say using anything else would be reinventing the wheel. |
Hello.
I've experienced an issue with this commit: taori/SE-Calculator@9a168ba
The error i'm running into is with NewShipViewModel.cs basically i have 2 methods with the same name where only the parameter type is different. However it will only enter the method with Delete(Thruster item) if i click on both types. For an energy source it too will enter the method with a thruster, but pass a null as parameter.
I suppose a little fix is required for caliburn to pick the correct method here?
The text was updated successfully, but these errors were encountered: