我知道通常,Mono中的MissingMethodException意味着您正在引用未在Mono中实现的框架的一部分,即使它在Microsoft .NET框架中可用。但是,在这种情况下,我收到一个MissingMethodException only 引用我自己的代码中的方法。但是,它只发生在Mono上。
由于异常在丢失方法之前不包含任何代码,我甚至不确定从哪里开始寻找问题。
以下是例外:
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:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.1\mcs\class\corlib\System.Reflect
ion\MonoMethod.cs:63
at System.Reflection.MonoMethod.GetPseudoCustomAttributes () [0x00002] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.1\mcs\class\corlib\System.Reflection\M
onoMethod.cs:295
at System.MonoCustomAttrs.GetPseudoCustomAttributes (ICustomAttributeProvider obj, System.Type attributeType) [0x0000d] in C:\cygwin\tmp\monobuild\build\BUILD
\mono-2.10.1\mcs\class\corlib\System\MonoCustomAttrs.cs:68
at System.MonoCustomAttrs.IsDefined (ICustomAttributeProvider obj, System.Type attributeType, Boolean inherit) [0x00039] in C:\cygwin\tmp\monobuild\build\BUIL
D\mono-2.10.1\mcs\class\corlib\System\MonoCustomAttrs.cs:291
at System.Reflection.MonoMethod.IsDefined (System.Type attributeType, Boolean inherit) [0x00000] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.1\mcs\class\
corlib\System.Reflection\MonoMethod.cs:276
at Microsoft.Internal.AttributeServices.IsAttributeDefined[ExportAttribute] (ICustomAttributeProvider attributeProvider, Boolean inherit) [0x00000] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.1\mcs\class\System.ComponentModel.Composition\src\ComponentModel\Microsoft\Internal\AttributeServices.cs:40
at System.ComponentModel.Composition.AttributedModel.AttributedPartCreationInfo.IsExport (ICustomAttributeProvider attributeProvider) [0x00000] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.1\mcs\class\System.ComponentModel.Composition\src\ComponentModel\System\ComponentModel\Composition\AttributedModel\AttributedPartCreationInfo.cs:355
at System.ComponentModel.Composition.AttributedModel.AttributedPartCreationInfo+<GetExportMembers>c__Iterator0.MoveNext () [0x001b5] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.1\mcs\class\System.ComponentModel.Composition\src\ComponentModel\System\ComponentModel\Composition\AttributedModel\AttributedPartCreationInfo.cs:304
at System.Linq.Enumerable.Any[MemberInfo] (IEnumerable`1 source) [0x00024] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.1\mcs\class\System.Core\System.Linq\Enumerable.cs:136
at System.ComponentModel.Composition.AttributedModel.AttributedPartCreationInfo.HasExports () [0x00000] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.1\mcs\class\System.ComponentModel.Composition\src\ComponentModel\System\ComponentModel\Composition\AttributedModel\AttributedPartCreationInfo.cs:106
at System.ComponentModel.Composition.AttributedModel.AttributedPartCreationInfo.IsPartDiscoverable () [0x0003a] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.1\mcs\class\System.ComponentModel.Composition\src\ComponentModel\System\ComponentModel\Composition\AttributedModel\AttributedPartCreationInfo.cs:95
at System.ComponentModel.Composition.AttributedModel.AttributedModelDiscovery.CreatePartDefinitionIfDiscoverable (System.Type type, ICompositionElement origin) [0x0000a] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.1\mcs\class\System.ComponentModel.Composition\src\ComponentModel\System\ComponentModel\Composition\AttributedModel\AttributedModelDiscovery.cs:19
at System.ComponentModel.Composition.Hosting.TypeCatalog.get_PartsInternal () [0x00051] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.1\mcs\class\System.ComponentModel.Composition\src\ComponentModel\System\ComponentModel\Composition\Hosting\TypeCatalog.cs:166
at System.ComponentModel.Composition.Hosting.TypeCatalog.CreateIndex () [0x0000b] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.1\mcs\class\System.ComponentModel.Composition\src\ComponentModel\System\ComponentModel\Composition\Hosting\TypeCatalog.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:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.1\mcs\class\corlib\System\Lazy.cs:155
答案 0 :(得分:3)
知道了! Mono中的MEF似乎不喜欢引用没有导出的DLL的DirectoryCatalog。我指着当前的汇编目录,这在Mono中是禁止的。