uwp-desktop: The type forwarder for type 'Windows.Foundation.IAsyncOperation`1' in assembly 'Windows' causes a cycle
I’d like to use await with IAsyncOperation. after I added
c:\Program Files (x86)\Windows Kits\10\UnionMetadata\Facade\Windows.WinMD
c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.Runtime.WindowsRuntime.dll
I got:
The type forwarder for type 'Windows.Foundation.IAsyncOperation`1' in assembly 'Windows' causes a cycle
About this issue
- Original URL
- State: open
- Created 8 years ago
- Reactions: 1
- Comments: 15
@JamesEarle @bao-qian the instructions in this repo and on the nuget site are wrong. You do not manually add the facade for the API you need. This is what causes the circular reference.
You simply add the full Windows.winmd at
C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.16299.0\Windows.winmd
andSystem.Runtime.WindowsRuntime
. That’s it. Note when I say “full”, I mean the.winmd
file should be a few megabytes. There’s plenty of them with the same name sprinkled around that are a few kb and it’s easy to screw up and select one of these.Then, wherever you call
await
on anIAsyncOperation
, make sure you haveusing System;
in the same source file.Hope this helps people.
This issue is currently crushing my hopes and dreams.
@TechnikEmpire Thank you for clarifying this! I had previously added the “Target Platform = 10” in the .csproj file, then added the UWP references as needed and hit the circular reference issue. Simply doing the two things you recommended fixed the issues (including getting the right version of the .winmd file).