-
Notifications
You must be signed in to change notification settings - Fork 565
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
Replace use of Type.GetInterfaceMap in TypeLoader #163
Conversation
TypeLoader uses Type.GetInterfaceMap() to find an implementation method corresponding to a method from an interface. But in NET Native this method throws PlatformNotSupportedException. As a consequence, Duplex does not work in NET Native. This PR replaces the call to Type.GetInterfaceMap() with private methods that find the implementation method based on the method name and parameter types. Fixes #153
} | ||
|
||
return true; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about other properties like outs/refs or return value types?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I will add those. Also generic vs non-generic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: would async
be part of this as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, async tells the compiler to generate code for a state machine for async continuations from await calls within the method body and automatically create a Task to be returned. It has no effect on the method signature at all. If you decompile an async method, the only way you know that the method was declared async is that the code is almost impossible to follow 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2nd commit increases the number of items compared. Curiously, testing MethodInfo's for being generic is not in public contract. The changes in the 2nd commit pass the existing duplex tests on our NET Native experimental test environment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, async tells the compiler to generate code for a state machine for async continuations from await calls within the method body and automatically create a Task to be returned. It has no effect on the method signature at all. If you decompile an async method, the only way you know that the method was declared async is that the code is almost impossible to follow 😄
@mconnew - good to know, thanks!
LGTM |
Replace use of Type.GetInterfaceMap in TypeLoader
TypeLoader uses Type.GetInterfaceMap() to find an implementation
method corresponding to a method from an interface. But in
NET Native this method throws PlatformNotSupportedException.
As a consequence, Duplex does not work in NET Native.
This PR replaces the call to Type.GetInterfaceMap() with private
methods that find the implementation method based on the method name
and parameter types.
Fixes #153