Skip to content

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

Merged
marek-safar merged 23 commits into
dotnet:masterfrom
kjpou1:wasm-fix-delegate-trimming
Feb 10, 2021
Merged

[browser] Fix System.Delegate.DynamicInvoke method can not be resolved#47519
marek-safar merged 23 commits into
dotnet:masterfrom
kjpou1:wasm-fix-delegate-trimming

Conversation

@kjpou1

@kjpou1kjpou1 commented Jan 27, 2021

Copy link
Copy Markdown
Contributor
  • 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.
@ghost

Copy link
Copy Markdown

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.

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

Copy link
Copy Markdown

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.
```
Comment threadsrc/mono/wasm/runtime/binding_support.js
@kjpou1
kjpou1 requested a review from radicalFebruary 2, 2021 10:54
@kjpou1

Copy link
Copy Markdown
ContributorAuthor

…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:masterFeb 10, 2021
@kjpou1
kjpou1 deleted the wasm-fix-delegate-trimming branch February 10, 2021 10:49
@ghostghost locked as resolved and limited conversation to collaborators Mar 12, 2021
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

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

@kjpou1@radical@kg@marek-safar@eerhardt