无法加载文件或程序集PInvoke

时间:2019-11-12 22:59:56

标签: c# asp.net-core breeze asp.net-core-3.0

我正在将BreezeJS应用程序转换为在.NET Core和Linux上运行。我到了要在WebAPI服务中保存所做更改的地步,并且出现以下错误:

  

无法加载文件或程序集'System.Runtime.InteropServices.PInvoke,版本= 4.0.0.0'

最后一个称为“微风”的方法称为IsFrameworkAssembly。我在这里找到此方法的.Net Core版本:IsFrameworkAssembly。它会调用GetCustomAttributes,然后进入系统代码。

我不确定这里出了什么问题。 .Net Core不支持GetCustomAttributes吗?这是.Net Core中的错误吗?还是这里还有其他事情?


 万一重要的是这里是完整的调用堆栈:

   at System.ModuleHandle.ResolveType(QCallModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type)
   at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
   at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
   at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(MetadataToken caCtorToken, MetadataImport& scope, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder`1& derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
   at System.Reflection.CustomAttribute.AddCustomAttributes(ListBuilder`1& attributes, RuntimeModule decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder`1 derivedAttributes)
   at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType)
   at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType)
   at System.Reflection.RuntimeAssembly.GetCustomAttributes(Type attributeType, Boolean inherit)
   at Breeze.Persistence.BreezeConfig.IsFrameworkAssembly(Assembly assembly)
   at Breeze.Persistence.BreezeConfig.c.b__5_0(Assembly a)
   at System.Linq.Enumerable.WhereArrayIterator`1.ToList()
   at Breeze.Persistence.BreezeConfig.get_ProbeAssemblies()
   at Breeze.Persistence.BreezeConfig.get_Instance()
   at Breeze.Persistence.PersistenceManager.CreateJsonSerializer()
   at Breeze.Persistence.PersistenceManager.InitializeSaveState(JObject saveBundle)
   at Breeze.Persistence.PersistenceManager.SaveChanges(JObject saveBundle, TransactionSettings transactionSettings)
   at MyService.DataAccess.SaveChanges(JObject saveJObject) 
   at MyService.Controllers.MainController.SaveChanges(JObject saveJObject) 
   at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()

0 个答案:

没有答案