的MissingMethodException瓦特/单声道单声道、MissingMethodException

由网友(決裂溫柔の)分享简介:我知道,通常情况下,在的MissingMethodException单意味着​​你要引用未在单声道实施框架的一部分,即使它是在Microsoft .NET框架提供。然而,在这种情况下,我接收到的MissingMethodException的仅的参照自己code进行方法。然而,这仅发生在单由于异常不包含任何我的code,...

我知道,通常情况下,在的MissingMethodException单意味着​​你要引用未在单声道实施框架的一部分,即使它是在Microsoft .NET框架提供。然而,在这种情况下,我接收到的MissingMethodException的仅的参照自己code进行方法。然而,这仅发生在单

由于异常不包含任何我的code,直到缺失的方法,我甚至不知道从哪里开始寻找这个问题。

下面是例外:

 未处理的异常:System.MissingMethodException:未找到方法:ParkingMapper.GeoHash.IndexGeoHash。
  在(包装管理到本机)System.Reflection.MonoMethodInfo:get_method_info(IntPtr的,System.Reflection.MonoMethodInfo和放大器;)
  在System.Reflection.MonoMethodInfo.GetMethodInfo(IntPtr的手柄)[0x00000]在C: cygwin的 TMP  monobuild 编译 BUILD 单2.10.1  MCS 类 corlib  System.Reflect
离子 MonoMethod.cs:63
  在System.Reflection.MonoMethod.GetPseudoCustomAttributes()[0x00002]在C: cygwin的 TMP  monobuild 编译 BUILD 单2.10.1  MCS 类 corlib 的System.Reflection 中号
onoMethod.cs:295
  在System.MonoCustomAttrs.GetPseudoCustomAttributes(ICustomAttributeProvider OBJ,System.Type的属性类型)0x0000d]在C: cygwin的 TMP  monobuild 建立 BUILD
单2.10.1  MCS 类 corlib  SYSTEM  MonoCustomAttrs.cs:68
  在System.MonoCustomAttrs.IsDefined(ICustomAttributeProvider OBJ,System.Type的属性类型,布尔继承)[0x00039]在C: cygwin的 TMP  monobuild 建立 BUIL
ð单2.10.1  MCS 类 corlib  SYSTEM  MonoCustomAttrs.cs:291
  在System.Reflection.MonoMethod.IsDefined(System.Type的属性类型,布尔继承)[0x00000]在C: cygwin的 TMP  monobuild 编译 BUILD 单2.10.1  MCS 类
corlib 的System.Reflection  MonoMethod.cs:276
  在Microsoft.Internal.AttributeServices.IsAttributeDefined [ExportAttribute](ICustomAttributeProvider attributeProvider,布尔继承)[0x00000]中C:cygwintmpmonobuildbuildBUILDmono-2.10.1mcsclassSystem.ComponentModel.CompositionsrcComponentModelMicrosoftInternalAttributeServices.cs:40
  在System.ComponentModel.Composition.AttributedModel.AttributedPartCreationInfo.IsExport(ICustomAttributeProvider attributeProvider)[0x00000]中C:cygwintmpmonobuildbuildBUILDmono-2.10.1mcsclassSystem.ComponentModel.CompositionsrcComponentModelSystemComponentModelCompositionAttributedModelAttributedPartCreationInfo.cs:355
  在System.ComponentModel.Composition.AttributedModel.AttributedPartCreationInfo+<GetExportMembers>c__Iterator0.MoveNext ()[0x001b5]在C:cygwintmpmonobuildbuildBUILDmono-2.10.1mcsclassSystem.ComponentModel.CompositionsrcComponentModelSystemComponentModelCompositionAttributedModelAttributedPartCreationInfo.cs:304
  在System.Linq.Enumerable.Any [的MemberInfo](IEnumerable`1源)[0x00024]在C: cygwin的 TMP  monobuild 编译 BUILD 单2.10.1  MCS 类 System.Core程序系统。 LINQ的 Enumerable.cs:136
  在System.ComponentModel.Composition.AttributedModel.AttributedPartCreationInfo.HasExports()[0x00000]在C:cygwintmpmonobuildbuildBUILDmono-2.10.1mcsclassSystem.ComponentModel.CompositionsrcComponentModelSystemComponentModelCompositionAttributedModelAttributedPartCreationInfo.cs:106
  在System.ComponentModel.Composition.AttributedModel.AttributedPartCreationInfo.IsPartDiscoverable()[0x0003a]在C:cygwintmpmonobuildbuildBUILDmono-2.10.1mcsclassSystem.ComponentModel.CompositionsrcComponentModelSystemComponentModelCompositionAttributedModelAttributedPartCreationInfo.cs:95
  在System.ComponentModel.Composition.AttributedModel.AttributedModelDiscovery.CreatePartDefinitionIfDiscoverable (System.Type的类型,ICompositionElement原点)[0x0000a]中C:cygwintmpmonobuildbuildBUILDmono-2.10.1mcsclassSystem.ComponentModel.CompositionsrcComponentModelSystemComponentModelCompositionAttributedModelAttributedModelDiscovery.cs:19
  在System.ComponentModel.Composition.Hosting.TypeCatalog.get_PartsInternal()[0x00051]在C:cygwintmpmonobuildbuildBUILDmono-2.10.1mcsclassSystem.ComponentModel.CompositionsrcComponentModelSystemComponentModelCompositionHostingTypeCatalog.cs:166
  在System.ComponentModel.Composition.Hosting.TypeCatalog.CreateIndex()[0x0000b]在C:cygwintmpmonobuildbuildBUILDmono-2.10.1mcsclassSystem.ComponentModel.CompositionsrcComponentModelSystemComponentModelCompositionHostingTypeCatalog.cs:263
  在System.Lazy`1[System.Collections.Generic.IDictionary`2[System.String,System.Collections.Generic.List`1[System.ComponentModel.Composition.Primitives.ComposablePartDefinition]]].InitValue ()[0x0014f]在C: cygwin的 TMP  monobuild 编译 BUILD 单2.10.1  MCS 类 corlib  SYSTEM  Lazy.cs:155
 

解决方案

明白了!看来MEF的单不喜欢DirectoryCatalog引用的DLL,没有出口。我指着当前组件目录,这是一个禁忌的单声道。

I am aware that typically, MissingMethodException in Mono means that you are referencing a part of the framework that isn't implemented in Mono, even though it is available in the Microsoft .NET framework. However, in this case, I am receiving a MissingMethodException only referring to a method in my own code. However, it only occurs on Mono.

Since the exception doesn't contain any of my code until the missing method, I'm not even sure where to begin to look for the issue.

Here is the exception:

Unhandled Exception: System.MissingMethodException: Method not found: 'ParkingMapper.GeoHash.IndexGeoHash'.
  at (wrapper managed-to-native) System.Reflection.MonoMethodInfo:get_method_info (intptr,System.Reflection.MonoMethodInfo&)
  at System.Reflection.MonoMethodInfo.GetMethodInfo (IntPtr handle) [0x00000] in C:cygwintmpmonobuildbuildBUILDmono-2.10.1mcsclasscorlibSystem.Reflect
ionMonoMethod.cs:63
  at System.Reflection.MonoMethod.GetPseudoCustomAttributes () [0x00002] in C:cygwintmpmonobuildbuildBUILDmono-2.10.1mcsclasscorlibSystem.ReflectionM
onoMethod.cs:295
  at System.MonoCustomAttrs.GetPseudoCustomAttributes (ICustomAttributeProvider obj, System.Type attributeType) [0x0000d] in C:cygwintmpmonobuildbuildBUILD
mono-2.10.1mcsclasscorlibSystemMonoCustomAttrs.cs:68
  at System.MonoCustomAttrs.IsDefined (ICustomAttributeProvider obj, System.Type attributeType, Boolean inherit) [0x00039] in C:cygwintmpmonobuildbuildBUIL
Dmono-2.10.1mcsclasscorlibSystemMonoCustomAttrs.cs:291
  at System.Reflection.MonoMethod.IsDefined (System.Type attributeType, Boolean inherit) [0x00000] in C:cygwintmpmonobuildbuildBUILDmono-2.10.1mcsclass
corlibSystem.ReflectionMonoMethod.cs:276
  at Microsoft.Internal.AttributeServices.IsAttributeDefined[ExportAttribute] (ICustomAttributeProvider attributeProvider, Boolean inherit) [0x00000] in C:cygwintmpmonobuildbuildBUILDmono-2.10.1mcsclassSystem.ComponentModel.CompositionsrcComponentModelMicrosoftInternalAttributeServices.cs:40
  at System.ComponentModel.Composition.AttributedModel.AttributedPartCreationInfo.IsExport (ICustomAttributeProvider attributeProvider) [0x00000] in C:cygwintmpmonobuildbuildBUILDmono-2.10.1mcsclassSystem.ComponentModel.CompositionsrcComponentModelSystemComponentModelCompositionAttributedModelAttributedPartCreationInfo.cs:355
  at System.ComponentModel.Composition.AttributedModel.AttributedPartCreationInfo+<GetExportMembers>c__Iterator0.MoveNext () [0x001b5] in C:cygwintmpmonobuildbuildBUILDmono-2.10.1mcsclassSystem.ComponentModel.CompositionsrcComponentModelSystemComponentModelCompositionAttributedModelAttributedPartCreationInfo.cs:304
  at System.Linq.Enumerable.Any[MemberInfo] (IEnumerable`1 source) [0x00024] in C:cygwintmpmonobuildbuildBUILDmono-2.10.1mcsclassSystem.CoreSystem.LinqEnumerable.cs:136
  at System.ComponentModel.Composition.AttributedModel.AttributedPartCreationInfo.HasExports () [0x00000] in C:cygwintmpmonobuildbuildBUILDmono-2.10.1mcsclassSystem.ComponentModel.CompositionsrcComponentModelSystemComponentModelCompositionAttributedModelAttributedPartCreationInfo.cs:106
  at System.ComponentModel.Composition.AttributedModel.AttributedPartCreationInfo.IsPartDiscoverable () [0x0003a] in C:cygwintmpmonobuildbuildBUILDmono-2.10.1mcsclassSystem.ComponentModel.CompositionsrcComponentModelSystemComponentModelCompositionAttributedModelAttributedPartCreationInfo.cs:95
  at System.ComponentModel.Composition.AttributedModel.AttributedModelDiscovery.CreatePartDefinitionIfDiscoverable (System.Type type, ICompositionElement origin) [0x0000a] in C:cygwintmpmonobuildbuildBUILDmono-2.10.1mcsclassSystem.ComponentModel.CompositionsrcComponentModelSystemComponentModelCompositionAttributedModelAttributedModelDiscovery.cs:19
  at System.ComponentModel.Composition.Hosting.TypeCatalog.get_PartsInternal () [0x00051] in C:cygwintmpmonobuildbuildBUILDmono-2.10.1mcsclassSystem.ComponentModel.CompositionsrcComponentModelSystemComponentModelCompositionHostingTypeCatalog.cs:166
  at System.ComponentModel.Composition.Hosting.TypeCatalog.CreateIndex () [0x0000b] in C:cygwintmpmonobuildbuildBUILDmono-2.10.1mcsclassSystem.ComponentModel.CompositionsrcComponentModelSystemComponentModelCompositionHostingTypeCatalog.cs:263
  at System.Lazy`1[System.Collections.Generic.IDictionary`2[System.String,System.Collections.Generic.List`1[System.ComponentModel.Composition.Primitives.ComposablePartDefinition]]].InitValue () [0x0014f] in C:cygwintmpmonobuildbuildBUILDmono-2.10.1mcsclasscorlibSystemLazy.cs:155

解决方案

Got it! It seems MEF in Mono doesn't like a DirectoryCatalog that references DLLs with no exports. I was pointing at the current assembly directory, which is a no-no in Mono.

阅读全文

相关推荐

最新文章