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

[browser] Fix System.Delegate.DynamicInvoke method can not be resolved #47519

Merged
merged 23 commits into from
Feb 10, 2021
Merged

[browser] Fix System.Delegate.DynamicInvoke method can not be resolved #47519

merged 23 commits into from
Feb 10, 2021

Conversation

kjpou1
Copy link
Contributor

@kjpou1 kjpou1 commented Jan 27, 2021

  • When building an app using <PublishTrimmed>true</PublishTrimmed> the linker is linking out System.Delegate.DynamicInvoke
  • Call Delegate Invoke directly

Remove dependency on System.Delegate.DynamicInvoke

  • Explicitly provide the declaring type to GetMethodFromHandle in GetCallSignature
  • Fixes error resolving generic method handles.
       Error: System.ArgumentException: Cannot resolve method Int32 Invoke(Int32, Int32) because the declaring type of the method handle System.Func`3[T1,T2,TResult] is generic. Explicitly provide the declaring type to GetMethodFromHandle.
    

Add method to retrieve the Invoke method of the delegate


Added delegate tests.

Fix #47516

- When building an app using <PublishTrimmed>true</PublishTrimmed> the linker is linking out System.Delegate.DynamicInvoke
- Add this to the linker trim exclusions.
@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

@kjpou1 kjpou1 self-assigned this Jan 27, 2021
@kjpou1 kjpou1 added the arch-wasm WebAssembly architecture label Jan 27, 2021
@ghost
Copy link

ghost commented Jan 27, 2021

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details
  • When building an app using true the linker is linking out System.Delegate.DynamicInvoke
  • Add this to the linker trim exclusions.
Author: kjpou1
Assignees: kjpou1
Labels:

arch-wasm

Milestone: -

```
resource System.Private.Runtime.InteropServices.JavaScript.xml in System.Private.Runtime.InteropServices.JavaScript, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a : warning IL2007: Could not resolve assembly 'System.Private.CoreLib' [/src/libraries/System.Private.Runtime.InteropServices.JavaScript/src/System.Private.Runtime.InteropServices.JavaScript.csproj]
    1 Warning(s)
    0 Error(s)
```
- Explicitly provide the declaring type to GetMethodFromHandle in GetCallSignature
- Fixes error resolving generic method handles.
   ```
      Error: System.ArgumentException: Cannot resolve method Int32 Invoke(Int32, Int32) because the declaring type of the method handle System.Func`3[T1,T2,TResult] is generic. Explicitly provide the declaring type to GetMethodFromHandle.
   ```
@kjpou1 kjpou1 requested a review from radical February 2, 2021 10:54
@kjpou1
Copy link
Contributor Author

kjpou1 commented Feb 4, 2021

@marek-safar @lewing @radical

…fix-delegate-trimming

# Conflicts:
#	src/libraries/System.Private.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/Runtime.cs
@marek-safar marek-safar merged commit eab1b43 into dotnet:master Feb 10, 2021
@kjpou1 kjpou1 deleted the wasm-fix-delegate-trimming branch February 10, 2021 10:49
@ghost ghost locked as resolved and limited conversation to collaborators Mar 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[browser] Uncaught Error: System.Delegate.DynamicInvoke method can not be resolved.
5 participants