Skip to content
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

Merged
merged 2 commits into from
Jul 15, 2015
Merged

Replace use of Type.GetInterfaceMap in TypeLoader #163

merged 2 commits into from
Jul 15, 2015

Conversation

roncain
Copy link
Contributor

@roncain roncain commented Jul 13, 2015

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

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;
}
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Member

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?

Copy link
Member

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 😄

Copy link
Contributor Author

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.

Copy link
Member

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!

@sajayantony
Copy link
Contributor

:shipit:

@iamjasonp
Copy link
Member

LGTM

iamjasonp added a commit that referenced this pull request Jul 15, 2015
Replace use of Type.GetInterfaceMap in TypeLoader
@iamjasonp iamjasonp merged commit 246289a into dotnet:master Jul 15, 2015
@roncain roncain deleted the duplex-netnative-pnse branch July 15, 2015 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants