TypeLoadException: Could not load type TaskAwaiter from System.Runtime
See original GitHub issueI am trying to generate a CSharp client for my asp.net core Web Api project. I added the “PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>” to the csproj, which didnt work and then I compiled self contained via CLI. When generating output I get the following exception however:
Could not load type ‘System.Runtime.CompilerServices.TaskAwaiter`1’ from assembly 'System.Runtime, Version=4.0.0.0, Culture…
Server stack trace:
at System.Reflection.CustomAttribute._CreateCaObject(RuntimeModule pModule, IRuntimeMethodInfo pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs)
at System.Reflection.CustomAttribute.CreateCaObject(RuntimeModule module, IRuntimeMethodInfo ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeMethodInfo method, RuntimeType caType, Boolean inherit)
at System.Attribute.GetCustomAttributes(MemberInfo element, Boolean inherit)
at NSwag.SwaggerGeneration.WebApi.WebApiToSwaggerGenerator.<>c.<GetActionMethods>b__14_1(MethodInfo m)
at System.Linq.Enumerable.<>c__DisplayClass6_01.<CombinePredicates>b__0(TSource x) at System.Linq.Enumerable.WhereArrayIterator
1.MoveNext()
at NSwag.SwaggerGeneration.WebApi.WebApiToSwaggerGenerator.<GenerateForControllerAsync>d__11.MoveNext()
Whats up here?
Issue Analytics
- State:
- Created 6 years ago
- Comments:14 (12 by maintainers)
Implementation: https://github.com/RSuter/NSwag/issues/953
In v11.7 the annotations redirect is removed, you can use studio to create the nswag.json file and run it via cmd line and the core binaries.
I hope to find a solution for this so that it also works in a full .net process.