runtime: [Wasm][AOT] Can't find custom attr constructor image: InternalsVisibleToAttribute..ctor(string)
Description
When building an application, AOT may fail with the following error:
Mono Ahead of Time compiler - compiling assembly /path/to/my.dll
Can't find custom attr constructor image: /path/to/my.dll mtoken: 0x0a000f71 due to: Method not found: void System.Runtime.CompilerServices.InternalsVisibleToAttribute..ctor(string)
Workaround
<assembly fullname="System.Private.Corelib">
<type fullname="System.Runtime.CompilerServices.InternalsVisibleToAttribute" />
</assembly>
Configuration
dotnet: 8170c06395191ed6ffbf1e8b49e17c1cef7df5d1 linker: c44302b73f744c24293c3092a011655f1a4fffe0
Regression?
yes
Other information
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 16 (14 by maintainers)
Commits related to this issue
- Add repro for https://github.com/dotnet/runtime/issues/49874 — committed to jeromelaban/Wasm.Samples by jeromelaban 3 years ago
I’ll make a repro and link it here.
Isn’t this a linker bug? the assembly apparently has an
InternalsVisibleToattribute, but that class’ ctor was trimmed from corlib. If the attributte is used on an app assembly, why is it getting trimmed away from corlib?Note that this issue also affects interpreter only builds, but at runtime.